Fixed "crash at the end of the game" bug

- Fixed an issue where the game would sometimes crash when the game
ended.
- It was because of a concurrency issue with input and the some of the
Game Logic Functions