Fixed bug where listener was not attached to process close so shutdown did not happen correctly.