Outputing to only one file. Mistery tag inserted at the end