allow multiple files to be created in one run for less memory usage + clean up