[qtcontacts-sqlite] Ensure all detail table queries are finished

If we fail to prepare a details table query, return an error and
ensure that any queries that were activated are finalized.
Merge pull request #160 from matthewvogt/finish-queries

[qtcontacts-sqlite] Ensure all detail table queries are finished