ensure a trailing endline is output to stream