@Override
    public void close() {
        log.debug("Removing error handling metrics of group {}", metricGroup.groupId());
        metricGroup.close();
    }
Close the task Error metrics group when the task is closed
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/ErrorHandlingMetrics.java