All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
There is no doubt that seclusion between a man and a non-mahram woman is prohibited. As mentioned in the hadith: “A man must not be alone with a woman except in the presence of a Mahram.” [Al-Bukhari and Muslim]. Seclusion means a meeting between a man and a woman in a place where they feel safe that no one can enter upon them. Ibn Nujaim said: “It was stated in Majmoo’ An-Nawazil that if no one enters upon them except with their permission, then it is seclusion.”
Also, it was stated in Hashiyat Al-Bujairmi Al-Shafi’i: “Seclusion is realized when there is a meeting, and there is a doubt that something wrong may happen between them. Unlike if it is guaranteed that there is no doubt, then it is not seclusion.”
Therefore, if your mother closes her room door, and they cannot open it, then there is no doubt in it, especially when they are a group of men and not only one man. Some scholars are of the view that seclusion cannot be realized with a group of men, unlike a man with a woman. The conclusion is that as long as your mother is in a locked room, and they are outside, then it is guaranteed that there is no doubt. Therefore there is no seclusion in this case. Thus, if you feel safe leaving your mother with those men in the apartment, then there is nothing wrong with you going to the mosque to pray Taraaweeh and leaving her in the room, knowing that praying Taraweeh in the mosque is recommended and not obligatory.
As for your staying with your brother’s wife in the house alone, we are of the view that it is not permissible even if each of you stays in a separate room.
Allah knows best.