Fix the way filenames are used in output file (remove CSV extension)