[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.