docs: @SuppressWarnings({ "rawtypes", "unchecked" })
    public void close() throws IOException {
      if (!closed) {
        closeNewList();
        if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
          // compute initial basic list
          TreeMap<String, MtasDataItem<T1, T2>> basicList = new TreeMap<>();
          for (int i = 0; i < getSize(); i++) {
            MtasDataItem<T1, T2> newItem = getItem(i);
            if (basicList.containsKey(keyList[i])) {
              newItem.add(basicList.get(keyList[i]));
            }
            basicList.put(keyList[i], newItem);
          }
          // create result based on basic list
          result = new MtasDataCollectorResult<>(collectorType, sortType,
              sortDirection, basicList, start, number);
          // reduce
          if (segmentRegistration != null) {
            if (segmentRegistration.equals(SEGMENT_SORT_ASC)
                || segmentRegistration.equals(SEGMENT_SORT_DESC)) {
              reduceToKeys(result.getComparatorList().keySet());
            } else if (segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)
                || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
              Map<String, MtasDataItemNumberComparator> comparatorList = result
                  .getComparatorList();
              HashSet<String> filteredKeySet = new HashSet<>();
              if (segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)) {
                for (Entry<String, MtasDataItemNumberComparator> entry : comparatorList
                    .entrySet()) {
                  if (entry.getValue().compareTo(segmentValueBoundary) < 0) {
                    filteredKeySet.add(entry.getKey());
                  }
                }
              } else {
                for (Entry<String, MtasDataItemNumberComparator> entry : comparatorList
                    .entrySet()) {
                  if (entry.getValue().compareTo(segmentValueBoundary) > 0) {
                    filteredKeySet.add(entry.getKey());
                  }
                }
              }
              reduceToKeys(filteredKeySet);
              basicList.keySet().retainAll(filteredKeySet);
              result = new MtasDataCollectorResult<>(collectorType, sortType,
                  sortDirection, basicList, start, number);
            }
          }
        } else if (collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) {
          if (getSize() > 0) {
            result = new MtasDataCollectorResult<>(collectorType, getItem(0));
          } else {
            result = new MtasDataCollectorResult<>(collectorType, sortType,
                sortDirection);
          }
        } else {
          throw new IOException("type " + collectorType + " not supported");
        }
        closed = true;
      }
    }