Previously, we always saved the trace for each context until the
very end of the test, and then either repacked them or abandoned
depending on the `trace` mode.
However, this could result in downloading large traces from the
remote server when the tests succeeded but trace was set to
`retain-on-failure`. This slows down remote operations quite a lot.
The fix is to carefully consider whether the trace should be
saved or abandoned, based on whether the test and afterEach hooks
have finished successfully.
This could be a minor regression, where the trace will not be saved
if one of the fixture teardowns fails after the context has been
already closed, and trace mode was `retain-on-failure` or
`retain-on-first-failure`.