iTerm - append '\n' when cmd ends in space

When cmd ends in a space, iTerm will not execute that line. Therefore append '\n'.