The sqlite3_close() interface returns SQLITE_OK even if there are outstanding
sqlite3_stmt and sqlite3_backup objects.  The connection becomes a zombie.
Resource deallocation is deferred until the last sqlite3_stmt or 
sqlite3_backup object closes.  This is intended to help SQLite play nicer
with garbage collectors.

FossilOrigin-Name: e276a02b7f54e804caa553dca99023416a415e1c
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 85dabb0..9732c8f 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -974,6 +974,7 @@
 #define SQLITE_MAGIC_SICK     0x4b771290  /* Error and awaiting close */
 #define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */
 #define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred */
+#define SQLITE_MAGIC_ZOMBIE   0x64cffc7f  /* Close with last statement close */
 
 /*
 ** Each SQL function is defined by an instance of the following
@@ -2833,6 +2834,7 @@
 void sqlite3RollbackTransaction(Parse*);
 void sqlite3Savepoint(Parse*, int, Token*);
 void sqlite3CloseSavepoints(sqlite3 *);
+void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
 int sqlite3ExprIsConstant(Expr*);
 int sqlite3ExprIsConstantNotJoin(Expr*);
 int sqlite3ExprIsConstantOrFunction(Expr*);