I guess the reason you are getting "database is locked" is because since Sqlite databases are simply files on harddrive and one connection at a time blocks the file, other threads with separate connections can not access the database so you may consider locking the database when one connection is using it

Of course keeping the lock from start of transaction to the end of "safest", there's a good chance that'll lock up my gui
you stated queries take few moments,so that won't be a problem