improve type hints in shutdownlistener and add support for finish request event.
improve type hints.