Ticket 50659 AddressSanitizer: SEGV ... in bdb_pre_close
Bug: The crash reported is caused by calling dblayer_close twice in some
offline exec modes. Investigating the crash revealed another crash
in dbverify and memory leaks, one introduced by the backend
patch, two existing previously
Fix: - call dblayer_close only once
- initialize db env properly in dbverify execmode
- don't set sdn by reference when adding to entrydncache
- free collected instances from commandline in dbupgrade mode
- free bdb env in index mode
Reviewed by: William