Adjusted query counts to account for new savepoints.
Avoided closing the database connection within a transaction.

Refs #9437.