[FIX] Fix write lock errors
[FIX] Sometimes, processes updating the SQLite DB were dying because could not acquire the write lock. The SHARED lock in sqllite for select queries is only released when PDOStatement gets destroyed, and all SHARED locks need to be clear before acquiring the write lock.