Fix to prepared statement leak prevention

Don't execute any pending actions (e.g. DEALLOCATE) within a
transaction, since if these fail for any reason the transaction
will abort.