html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/pull/7880#issuecomment-1572412059,https://api.github.com/repos/pydata/xarray/issues/7880,1572412059,IC_kwDOAMm_X85duRqb,1217238,2023-06-01T16:51:07Z,2023-06-01T17:10:49Z,MEMBER,"Given that this error only is caused when Python is shutting down, which is exactly a case in which we do _not_ need to clean up open file objects, maybe we can remove the `__del__` instead? Something like: ```python import atexit @atexit.register def _remove_del_method(): # We don't need to close unclosed files at program exit, # and may not be able to do, because Python is cleaning up # imports. del CachingFileManager.__del__ ``` (I have not tested this!)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1730664352 https://github.com/pydata/xarray/pull/7880#issuecomment-1572350143,https://api.github.com/repos/pydata/xarray/issues/7880,1572350143,IC_kwDOAMm_X85duCi_,1217238,2023-06-01T16:16:40Z,2023-06-01T16:16:40Z,MEMBER,"I agree that this seems very hard to test! Have you verfied that this fixes things at least on your machine?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1730664352