process and clean up output files