Updated how to open output files