why is this while loop infinite? - C#