Everyone is different. Some need to be out, free and openly expressing their gender, anywhere, at all times. Others can be happy while being "in the closet."
Stepping back to a more philosophical argument, I think we each need to be content with what we have, and if we get in a better situation, to be grateful. I am for sure not saying that we need to be content with any evil we have to face, not at all. But I do think that many people seem to be unhappy until they get what they want (not what they need), then after they get it, they simply find something else they want (not need), and yet again feel unhappy.
A direct answer to your question is yes, contentment is possible for some staying in the closet, but I understand this situation may not be ideal for you or another particular person. There is much pleasure in being able to be yourself, out in the open. It is liberating.
There is nothing wrong with good aspirations and doing what is in your control to achieve them. There are a lot of people that concern themeselves too much with things in their personal lives that really are not in their control, they even worry and become very unhappy. I advise them to think of others more, as it really helps when you help others, as this takes the focus away from ourselves, at least for awhile.
So in the meantime, if your limit requires you "staying in the closet," make the most of that.
Perhaps someday you will have greater freedom and will be able to do more. Enjoy what you can do. Make the most of what you can do and experience.
Chrissy