This function is called before the engine deinitialisation to clean up the game before app termination.