sqlite3_close documenation clearly states:
Applications must complete all prepared statements and close all blob descriptors associated with the sqlite3 object before attempting to close the object. If sqlite3_close () is called in conjunction with a database that still has outstanding prepared statements or BLOB descriptors, then it returns SQLITE_BUSY.
source share