Maybe this shutdown hook should be part of the Extractor.  Managing this seems like a strange burden to put on the main method.