child_process: fix channel disconnect logic & cleanup pending handles
- Fix close not being emitted when calling process.disconnect() from a parent process.
- When there are pending handles that would never be closed because the other side has closed the channel, they are now closed 'manually'.
- Extend child disconnect test case to also check that 'close' was emitted.
Fixes: https://github.com/nodejs/node/issues/19433
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines