Implemented automatic cleanup after network listener termination