How to prevent Steam for closing my games without warning?

Your comments are different than your question, but I'll try to address both:

You cannot by default prevent Steam from closing games in situations where the Steam client itself closes after being used to open them. To help with this you should close the game and give the client a moment to finish syncing with the Steam Cloud before letting it restart/close, because even if the game doesn't use Steam Cloud the client is still going to update some config files. If it's not allowed to write & sync those files it may cause a crash, meaning the Steam client will run its updater on the next startup to make sure it's not broken and some configuration data may be lost.

The reason you can't leave them running but close Steam is partially because they are attached to it through SteamWorks to send data to the client, and another part may be because of how launching an external process is handled on operating systems (usually attached as a child to the parent that opens it, and so they die if it closes).

It may be possible to modify the client somehow to add functionality to "disown" a game's process so it's detached after launching, though that would almost definitely break SteamWorks integration. Where possible it would be easier to just launch the game through the executable directly instead as this would be some extremely shady and likely also difficult programming.

To find the executable of a given game you have installed, right click it in your Library and go to Properties -> Local Files and press "Browse Local Files". This may have changed slightly with the UI updates over the last couple years, but should be similar still.

There is a forum post on GOG.com from 2015 about DRM-free games on Steam that's still actively commented with additions, and it points to https://steam.fandom.com/wiki/List_of_DRM-free_games, which is still updated but may not have everything the forum post comments has.