avoid a race condition when writing to the leveldb store