Removed extra newline when writing to stdout

Output was slightly inconsistent when using stdin/stdout, as opposed to files