Since you are using SQLITE, you could ATTACH DATABASE to a 2nd database and simplify your code IMHO. Use DETACH DATABASE when you are ready to close your database, etc.

That way you only have to handle one database connection and simplify your code.