net: don't emit listening if handle is closed

Fixes #7834

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Merge remote-tracking branch 'upstream/master'