class ResultSetWrapper implements AutoCloseable {

    private final ResultSet resultSet;
    private final Statement statement;

    public ResultSetWrapper(ResultSet resultSet, Statement statement) {
        this.resultSet = resultSet;
        this.statement = statement;
    }

    public boolean next() throws SQLException {
        return !this.resultSet.isClosed() && this.resultSet.next();
    }

    @Override
    public void close() {<FILL_FUNCTION_BODY>}

    public ResultSet resultSet() {
        return resultSet;
    }
}

        try {
            if (this.resultSet != null) {
                this.resultSet.close();
            }
        } catch (SQLException e) {
            throw new BackendException("Failed to close ResultSet", e);
        } finally {
            try {
                if (this.statement != null) {
                    this.statement.close();
                }
            } catch (SQLException e) {
                throw new BackendException("Failed to close Statement", e);
            }
        }
    
<no_super_class>