iter_users streams users from the database so the export job can process large tables without loading every row into memory. Since a recent refactor, the export fails before it produces a single user: reading the first row raises RuntimeError: cursor is closed.
connect() returns a context manager that yields a connection. The connection's rows() method returns a lazy cursor: it reads rows from the connection while it is being iterated, and fails once the connection has been closed.