From e2615858942892bbc65d255efb401a24d8729660 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 8 Mar 2026 23:09:45 -0700 Subject: [PATCH] [gdsii] Try to close files if able --- masque/file/gdsii.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index c20200c..f589ad8 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -617,7 +617,12 @@ def load_libraryfile( stream = mmap.mmap(base_stream.fileno(), 0, access=mmap.ACCESS_READ) # type: ignore else: stream = path.open(mode='rb') # noqa: SIM115 - return load_library(stream, full_load=full_load, postprocess=postprocess) + + try: + return load_library(stream, full_load=full_load, postprocess=postprocess) + finally: + if full_load: + stream.close() def check_valid_names(