Fix unscoped SQL query causing transaction failures

This query wasn't explicitly scoped and never called finish(), so it was
still active during the rest of the store initialization. With some
newer versions of sqlite, this causes a subsequent transaction
commit to fail due to the active query.

Change-Id: Ide6c11aac89d48e2f75aa90c7dc33b0b32bb13e0
Reviewed-by: Valerio Valerio <valerio.valerio@jollamobile.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>