Fixed crash in Linux/Mac when quitting the game.