Adds logic for closing game and recording score in db, and more tests