title: "This transaction is closed" after rollback
body: <p>I'm trying to do some schema changes inside a transaction manager provided by pyramid. I'm running into various issues trying to run commit after a rollback:</p>
  
  <p>The simplified version is:</p>
  
  <pre><code>def get_version(conn):
      try:
          result = conn.execute('SELECT version FROM versions LIMIT 1')
          return result.scalar()
      except:
          conn.rollback()
          return 0
  
  def m_version_table(conn):
      conn.execute('CREATE TABLE versions (version INT)')
      conn.execute('INSERT INTO versions VALUES (1)')
  
  def handle(conn):
      ver = get_version(conn)
      m_version_table(conn)
  
  # task started with pyramid's transaction manager
      with env['request'].tm as tm:
          handle(env['request'].dbsession)
  </code></pre>
  
  <p>The transactions are started implicitly, which I can see in the logs:</p>
  
  <pre><code> BEGIN (implicit)
   SELECT version FROM versions LIMIT 1
   ()
   ROLLBACK
  
   BEGIN (implicit)
   CREATE TABLE versions (version INT)
   ()
   INSERT INTO versions VALUES (1)
   ()
   UPDATE versions SET version = %s
   (1,)
   ROLLBACK
  </code></pre>
  
  <p>If <code>versions</code> exists (and I run a different ALTER afterwards) everything works fine. But after the rollback, I just get:</p>
  
  <pre><code>Traceback (most recent call last):
    File ".venv/bin/schema_refresh", line 11, in &lt;module&gt;
      load_entry_point('project', 'console_scripts', 'schema_refresh')()
    File ".../schema_refresh.py", line 270, in run
      handle(env['request'].dbsession, tm)
    File ".../transaction-2.4.0-py3.7.egg/transaction/_manager.py", line 140, in __exit__
      self.commit()
    File ".../transaction-2.4.0-py3.7.egg/transaction/_manager.py", line 131, in commit
      return self.get().commit()
  ...
  sqlalchemy.exc.ResourceClosedError: This transaction is closed
  </code></pre>
  
  <p>Why can't the next transaction be committed, even if a new transaction has been correctly started after the rollback? (<code>ROLLBACK</code> is followed by <code>BEGIN (implicit)</code>)</p>