public void close() {
        if (task != null) {
            task.suspend();
            task.prepareCommit();
            task.postCommit(true);
            task.closeClean();
        }
        if (globalStateTask != null) {
            try {
                globalStateTask.close(false);
            } catch (final IOException e) {
                // ignore
            }
        }
        completeAllProcessableWork();
        if (task != null && task.hasRecordsQueued()) {
            log.warn("Found some records that cannot be processed due to the" +
                         " {} configuration during TopologyTestDriver#close().",
                     StreamsConfig.MAX_TASK_IDLE_MS_CONFIG);
        }
        if (processingMode == AT_LEAST_ONCE) {
            producer.close();
        }
        stateDirectory.clean();
    }
Close the driver, its topology, and all processors.
streams/test-utils/src/main/java/org/apache/kafka/streams/TopologyTestDriver.java