Do not hold the lock more than is necessary in FileDB.

Pay close attention here! :smiley: 
For the ```assert()```? I should have this in pull request #267 already.