[qtcontacts-sqlite] Avoid potential deadlock

Avoid deadlock that could occur by having two processes try to acquire
the two semaphores in reverse order.