Fixed up code to determine win/loss and UI to close the game.