Correct, contextlib.closing() is just an adapter that maps the context management protocol (i.e. __enter__/__exit__) to any object with a close() method. It's most useful when you can't readily alter the original definition of the objects involved.
If an object already supports the context management protocol directly (which includes most* file-like objects in the standard library), then you don't need the adapter.
(*if we've missed any, then feature requests to fix that are usually looked on quite favourably)
Comment
Correct, contextlib.closing() is just an adapter that maps the context management protocol (i.e. __enter__/__exit__) to any object with a close() method. It's most useful when you can't readily alter the original definition of the objects involved.
If an object already supports the context management protocol directly (which includes most* file-like objects in the standard library), then you don't need the adapter.
(*if we've missed any, then feature requests to fix that are usually looked on quite favourably)