implemented game saving on app close