handle case when db is not opened correctly
DRY test
sync & mapReduce
better error message
Merge pull request #42 from medea/open-close-state

handle case when db is not opened correctly