Skip to content

Commit b35c80f

Browse files
committed
Only close if file is a file
1 parent f17cd3c commit b35c80f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xarray/backends/file_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def close(self, needs_lock: bool = True) -> None:
238238
with self._optional_lock(needs_lock):
239239
default = None
240240
file = self._cache.pop(self._key, default)
241-
if needs_lock and self._lock:
241+
if needs_lock and self._lock and file is not None:
242242
with self._lock:
243243
file.close()
244244
else:

0 commit comments

Comments
 (0)