test: fix flaky http-client-timeout-agent
Close the connection immediately after receiving the end
event to
avoid that the timeout
event is fired before the connection closes
gracefully.
Fixes: https://github.com/nodejs/node/issues/19804
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines