convert output_csv() to write_csv() and make it require a file parameter