File read/write problems

Hello,
I have a form that send the submit to a php page. Here I am writting in a file and this is what happens:

header('Content-type: application/xml');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
$file = fopen($fileName, "w") or die ("Unable to open file!");

fwrite($fisier, 'text line');fwrite($fisier, "\n");

fclose($file);

readfile($fileName);
unlink($fileName);

echo "<script>window.location = 'page.php';</script>";

what is written in the last line with echo it is also written in my file. Why is that?