code: static void readerShutdown(String readerId, Position lastPosition, StateSynchronizer<ReaderGroupState> sync) {
          sync.updateState((state, updates) -> {
              Set<Segment> segments = state.getSegments(readerId);
              if (segments == null) {
                  return;
              }
              log.debug("Removing reader {} from reader grop. CurrentState is: {}", readerId, state);
              updates.add(new RemoveReader(readerId, lastPosition == null ? Collections.emptyMap()
                      : lastPosition.asImpl().getOwnedSegmentsWithOffsets()));
          });
      }
docs: Shuts down a reader, releasing all of its segments. The reader should cease all operations.
  @param lastPosition The last position the reader successfully read from.