As lastchance said the semi-colon at the end of 18 only does the while loop and the block after the while loop only is reached when the while condition fails.
Since the while loop will continue until there is nothing left to read and "eof" causes the loop to fail it is more likely that it is printing the last line of the file.