Add exit function for end of game loop