Missed one write()->writeln(). Fixed.