def close(self):
        """Clean up (if no more connections to the db exist).

        * For in-memory: Delete the underlying SQL table from the
          in-memory database.

        * For on-disk: save and close connection
        """

        self.__decrement_connection_counter()
        if self.connection_count == 0:
            if self.dbfile == ":memory:":
                SQL = """DROP TABLE IF EXISTS __self__"""
                self.sql(SQL, asrecarray=False, cache=False)
            else:
                self.connection.commit()
                self.connection.close()
Clean up (if no more connections to the db exist).

        * For in-memory: Delete the underlying SQL table from the
          in-memory database.

        * For on-disk: save and close connection