diff --git a/cli/medperf/utils.py b/cli/medperf/utils.py index 0b013d236..b6e95a5db 100644 --- a/cli/medperf/utils.py +++ b/cli/medperf/utils.py @@ -191,8 +191,9 @@ def untar(filepath: str, remove: bool = True) -> str: logging.info(f"Uncompressing tar.gz at {filepath}") addpath = str(Path(filepath).parent) try: - with tarfile.open(filepath) as tar: - tar.extractall(addpath) + tar = tarfile.open(filepath) + tar.extractall(addpath) + tar.close() except tarfile.ReadError as e: raise ExecutionError("Cannot extract tar.gz file, " + e.__str__())