Only commit/rollback if transaction is active