It is necessary to do that when entering the trigger, the game either crashed with a mistake, or was the crash. Is it possible to do somehow?
You can use just output from the game, thanks to application.quit. This is the most correct way. If you want to depart, I can recommend an infinite cycle. The simplest solution)