write out files at end
Merge pull request #1 from eob/output-files

write out files at end