protected virtual void Dispose(bool disposing)
{
if (_handle == default(uint))
return;
if(!disposing)
throw new InvalidOperationException("The LightningDatabase was not disposed and cannot be reliably dealt with from the finalizer");
Environment.Disposing -= Dispose;
IsOpened = false;
_pinnedConfig.Dispose();
mdb_dbi_close(Environment.Handle(), _handle);
GC.SuppressFinalize(this);
_handle = default(uint);
}