Since we are enforcing stricter concurrency requirements for sqlite, we should make sure that the length of time we hold the db lock is minimal. Change-Id: Ie69e97667c4a36b4460bab73dcce5f7d423e0640