SQLite Forum

Is it safe to VACUUM on a new database connection?
> even though I try to close all readers right away

Define what is "close all readers" in your mind.

There is no way to "close" a "reader".  You may "close" a "connection" and you may "finalize" a "statement".  Which one of these options equates with "close a reader" in your mind?

You will note that the error is telling you that you forgot to "finalize a statement" or to commit/rollback a transaction.  These states can exist notwithstanding that you "closed the connection" embodying the abberent behaviour.