fixed possible NPE
fixed getHash() call with closed DB