fixes order of ops errors for exit/shutdown in both encrypted/nonencrypted db
Merge pull request #385 from n8fr8/bugs_shutdown

fixes order of ops errors for exit/shutdown in both encrypted/nonencrypt...