Fixed a timeout issue that could cause an endless loop upon sending the game to the background