In the end of my story I want to make my MC leave the world or the world gets destroyed or whatever. And make him feel he was better of in a time where he was still with his friends (the sidecharacters).
Nothing wrong with a world ending tragedy. They can make for some really thoughtful or emotional endings, and still leave the reader satisfied, even if you throw persistance of actions through the window.
Taking The Butterfly Effect as an example, and beware of heavy spoilers about the ending ahead:
The protagonist is stuck between a rock and a hard place, because no matter what he does, everything keeps going badly for everyone involved, and he may have just one last try before his brain finally collapses from all his memory rewritings, so he decides to dedicate his last jump to weed out what he thought was the root cause of all of his problems: his relationship with his love interest. It was for the best for everyone that they never ever met, so he retconned that fixed point in time by telling her that he would kill her if he ever saw her again the first time they met as kids, and gave every one of his friends a happy life, even if it meant making the rest of his life sad and dull. It is ultimately a story about self-sacrifice and altruism, about letting good things go if they are selfish, and where every single one of the other timelines are invalidated by the ending, but it still manages to be a satisfactory conclusion, since the story is mostly about the journey, how the character change, and how he reaches the final decision. The story may go to waste, but not the character development.
Going even further, you have the almost plotless and surrealistic game Yume Nikki. Heavy spoilers of the ending ahead:
After Madotsuki has explored the entirety of her psyche, and collected all the powerups (the things she was looking for?), she simply jumps out of the balcony. Why? Nobody knows, and it still sparks fan theories to this day. Was she already planning on committing suicide and just wanted to make sense of her feelings by exploring the darkest depths of her mind before doing it, or did she come to the conclusion that she wanted to die after finding all the artifacts? Unfortunately (or fortunately), we may never know due to the game's extremely surrealistic nature, but that's part of the appeal. We could say here that all character development here gets thrown out of the window (no pun intended), but then again, every character's development is eventually lost after they die, unless they are inmortal, but that's a quite nihilistic approach to life, which brings me to the next point.
Another example, this time from a short story I wrote some years ago, that I won't spoil because I doubt I will ever publish: in the near hedonistic future of 2052, after World War III and the posterior quick reconstruction of the world into gigantic metropoli, Spectra, a desensitivized daughter-of-the-post-war hacker, is tasked with stealing some important files from an friend of her before he leaves the country. Due to the dettachment issues caused by this survival-of-the-fittest dystopia and a life of social isolation, she gladly accepts, because of her absolute lack of morals and ethics; to her, this is no more serious than a game. Sadly, while she broke in her friend's house to bypass the insanely secure WAN setup he had, she ended his life in a split second decision in self defense. Even though she had been killing people remotely since she was a teenager, she never got to experience the consequences that resulted from her murders first hand. After a mental breakdown, she accidentally overdoses on the drug she was addicted to in an attempt to clam down her anxiety. Before passing out, though, she finally comes to sense with her long lost feelings -her humanity-, and leaves this world in peace.
What to do, when your story kills everyone involved, and nobody is there to remember what they went through, and their teachings? May be some hot take on my part, but I think nobody really likes thinking there is absolutely nothing after death, or at least while they are alive. If all the good emotions you are experiencing right now will go to waste some day, it makes no sense to treat yourself, because your existence will be lost like tears in rain, some day. This is nihilism, and true unironical defeatist gnostic nihilists are rather hard to find, which means they are probably not going to be a significant part of your readerbase.
Almost everybody, even people who insist that nothing exists after death, really want to think deep down that life is pointless, and since what happens after death is not something we will ever be able to unequivocally demonstrate, due to being a topic in the realm of metaphysics, or even "extraphysics", most people will find it rather easy to turn on their "suspension of disbelief" on all stories that would make no sense without assuming some metaphysics, specially if said metaphysics are ill defined and don't allude to any particular belief, like it would be in your case.
Hopeless stories can explore many interesting themes, like people's attitudes towards overcoming (or succumbing to) nihilism, the drives that push us forward, reuniting with yourself before leaving this world (something that happens in real life rather commonly), or simply the state of mind of people who know they are done and the end is near.
Remember that most stories are about journeys, and very few people don't return home after they are done. But they always bring with them a bit of that place before finally getting some well deserved rest. As long as that bit of that place exists in your story, you can say your ending is satisfactory.