Gracefully shutdown when stop_listener/1 is called

Implements the `shutdown` option as documented previously.