Ensure workers are cleaned up always (#71564)
This ensures we properly clean up workers even if an error is thrown
before our normal `.end()` call is done. This can be verified currently
by building `pnpm next test/e2e/app-dir/dynamic-io` which should
encounter an error and fail but the workers were previously being kept
and using lots of CPU, now they are properly cleaned up.