Add newline and flush stream after each record