diff --git a/leveldb/datastore.go b/leveldb/datastore.go index f3c752a..c041be3 100644 --- a/leveldb/datastore.go +++ b/leveldb/datastore.go @@ -147,9 +147,7 @@ func (d *Datastore) DiskUsage() (du uint64, err error) { // Close shuts down leveldb func (d *Datastore) Close() (err error) { - if d.closed.Load() { - err = ErrClosed - } + err = ErrClosed d.close.Do(func() { d.closeLock.Lock() err = d.db.Close()