code: public void closeResultSet() throws SQLException {
      if (rs != null) {
        if (!rs.isClosed()) {
          rs.close();
        }
        rs = null;
      }
    }
docs: Close the result set (if open) and null the rs variable.