add shutdown hook
Add shutdown hook to provide a controlled way of stopping.
This should be provided in class Main
.
What exactly should be done when the shutdown-hook is called? Especially looking at the different reasons for shutdown (system maintenance, corrupt disk, full disk, ...).