Pysqlite2.dbapi2.OperationalError: Unable to close due to unfinalised statements

From Helpful

In pysqlite you must close the cursor before closing the connection, even if you already commited the cursor.