SQLite Forum

Is it safe to VACUUM on a new database connection?

I continuously get an error when I run VACUUM that some statements are still running. I have no way of telling which statements those are, app is multi-threaded, even though I try to close all readers right away.

I read in the docs about VACUUM (https://sqlite.com/lang_vacuum.html):

"A VACUUM will fail if there is an open transaction on the database connection that is attempting to run the VACUUM. Unfinalized SQL statements typically hold a read transaction open, so the VACUUM might fail if there are unfinalized SQL statements on the same connection. VACUUM (but not VACUUM INTO) is a write operation and so if another database connection is holding a lock that prevents writes, then the VACUUM will fail."

I decided to open a new connection, and run just the VACUUM command on that. I understand that the other open transactions are gone. But is it safe to do this. What will happen with the other running statements? Will they fail? They seem to finish fine as far as I can tell. 

So main question is: Is it safe to do VACUUM in a new connection, and will the DB end up properly defraged?