Only write newline separator when there was output written.