fixed FlatDatabase file lock; added tests