[FIX] Core, Locking: fix semi-global lock when no database is opened