Fixed db locking problem in a better way. Closes #112. Also made a test driver for game.py.