Open leveldb only when you need to