US stocks trade mixed as S&P 500 ends just shy of all-time record