protected override void FreeUnManagedObjects() { if (Handle != default(IntPtr)) { LevelDbInterop.leveldb_close(Handle); } // it's critical that the database be closed first, as the logger and cache may depend on it. _cache?.Dispose(); _comparator?.Dispose(); }