Ensure mounted transports are closed even if main transport raises

BY
21d ago
+24-16

When closing a client with proxy mounts, if the main transport's close()/__exit__() raises an exception, the mounted proxy transports would never be cleaned up. This wraps transport cleanup in try/finally to ensure all transports are properly closed.

Affects Client.close(), Client.__exit__(), AsyncClient.aclose(), and AsyncClient.__aexit__().