Preserve the context stack by transferring it to a new instance.
contextlib/ExitStack.pop_all
ExitStack.pop_all