         self.db = levelDBOpen(path.cString)
     }
     
+    deinit {
+        self.close()
+    }
+    
     // MARK: - Class methods
     
     class func databaseInLibraryWithName(_ name: String) -> AnyObject {

        return results
    }
    
    func _startIterator(_ iterator: UnsafeMutablePointer<Void>, backward: Bool, prefix: String?, start key: String?) {
        var startingKey: String
        //if let prefix = prefix {
        if let prefix = prefix {
            startingKey = prefix
            if let key = key {
                if let range = key.rangeOfString(prefix) {
                    if range.startIndex == key.startIndex && range.count > 0 {
                        startingKey = key
                    }
                }
            }
            let len = startingKey.length
            // If a prefix is provided and the iteration is backwards

                    keyChar += i
                    if keyChar[0] < 255 {
                        keyChar[0] += 1
                        levelDBIteratorSeek(iterator, UnsafeMutablePointer<Int8>(startingKeyPtr), len)
                        if levelDBIteratorIsValid(iterator) {
                            levelDBIteratorMoveToLast(iterator)
                        }
