Need a way to run code on game-crash.

I was thinking you just need a thread that is separate to the game process. So when the game process ends, that thread still hangs around and does it’s saving.