Fix use of multiple context managers.