open output file for writing