Close #471 - sync sqlite operations to guard against deadlocks