diff --git a/rocketpy/simulation/monte_carlo.py b/rocketpy/simulation/monte_carlo.py index bb94643be..e61347b6a 100644 --- a/rocketpy/simulation/monte_carlo.py +++ b/rocketpy/simulation/monte_carlo.py @@ -224,7 +224,8 @@ def __setup_files(self, append): idx_i = len(input_file.readlines()) with open(self._output_file, open_mode, encoding="utf-8") as output_file: idx_o = len(output_file.readlines()) - open(self._error_file, open_mode, encoding="utf-8").close() + with open(self._error_file, open_mode, encoding="utf-8"): + pass if idx_i != idx_o and not append: warnings.warn(