Added EndGame function
Checking if the game is finished