code: def close_db(self, exception):
          
          if self.is_connected:
              if exception is None and not transaction.isDoomed():
                  transaction.commit()
              else:
                  transaction.abort()
              self.connection.close()
docs: Added as a `~flask.Flask.teardown_request` to applications to
          commit the transaction and disconnect ZODB if it was used during
          the request.