Because it involves a generator, @contextmanager creates managers that
are incompatible with ExitStack.pop_all() because they close during
that call -- exactly what pop_all() is intended to avoid.
So begin dropping @contextmanager in preference to explicit context
management classes/methods.