Fixed listener error on server shutdown.