void (Consumer<? super Exception> exceptionHandler) { if (fileState == null) return; new FlushingTask(fileState, true, exceptionHandler).run(); fileState = null; executor.shutdown(); executor = null; Runtime.getRuntime().removeShutdownHook(shutdownHook); running = false; }