Only display final \n if outputting (thanks, @asmeurer)