code: private void closePrevious(MtasTokenIdFactory mtasTokenIdFactory,
        Set<MtasParserObject> previous, Integer currentOffset,
        MtasCRMAncestors unknownAncestors,
        Map<String, List<MtasParserObject>> currentList,
        Map<String, Map<Integer, Set<String>>> updateList,
        Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets)
        throws MtasParserException, MtasConfigException {
      for (MtasParserObject previousObject : previous) {
        previousObject.setRealOffsetEnd(currentOffset);
        idPositions.put(previousObject.getId(), previousObject.getPositions());
        idOffsets.put(previousObject.getId(), previousObject.getOffset());
        previousObject.updateMappings(idPositions, idOffsets);
        unknownAncestors.unknown = previousObject.getUnknownAncestorNumber();
        computeMappingsFromObject(mtasTokenIdFactory, previousObject, currentList,
            updateList);
        currentList.get(MAPPING_TYPE_GROUP).remove(previousObject);
      }
    }
docs: Close previous.
  
  @param mtasTokenIdFactory the mtas token id factory
  @param previous the previous
  @param currentOffset the current offset
  @param unknownAncestors the unknown ancestors
  @param currentList the current list
  @param updateList the update list
  @param idPositions the id positions
  @param idOffsets the id offsets
  @throws MtasParserException the mtas parser exception
  @throws MtasConfigException the mtas config exception