I’m simulating some data sets (60 in total), where I loop over the same procedure 60 times, saving each data set as a CSV file before moving on to the next data set.
After doing this procedure 13 times (out of the 60), my code crashes with the following error:
ERROR: SystemError: close: Input/output error
I have attached a picture with the full error message. Specifically the error happens on line 269 in a function where I write the simulated data to a csv file using CSV.write (see same image).
I have no clue why I can run this procedure without faults 13 times before it then crashes. If I delete the generated csv files and start over, the code crashes at the exact same point.
Could it be a memory issue? Do I somehow have to properly ‘close’ each csv file after I am done writing to it?
Can’t seem to find the same error message anywhere online, so any help is appreciated.