fix: after(callback) called after response end (#94974)
Fixes a bug where if `after(callback)`was called after the response
ended, and no `after(callback)` calls occurred earlier, the callback
would never run.
Implementation-wise, what happens is:
1. when the first callback is scheduled, we do `runCallbacksOnClose()`,
which waits until `onClose` fires and starts the callback queue
2. but if no `after(callback)` calls occurred before the response ended,
then by the time we got to `runCallbacksOnClose()`, `onClose` has
already fired, so we'd wait forever
We now start listening for `onClose` when the context is initialized and
track the state (`isRequestClosed`), which avoids this.
I also did another drive-by fix here: if we only had `after(promise)`
calls, we wouldn't switch the workUnitStore's phase to `'after'`,
because we were only doing that in the `after(callback)` codepath. This
is relevant in #94964 which fixes some bugs around `after(promise)`.