Added shutdown hook.