StreamWriter writing some lines multiple times - C#