Writing of output files