async_hooks: only emit `after` for AsyncResource if stack not empty
We clear the async id stack inside the uncaught exception handler and
emit after
events in the process, so we should not emit after
a second time from the runInAsyncScope()
code.
This should match the behaviour we have in C++.
Fixes: https://github.com/nodejs/node/issues/30080
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines