The S&P 500 and the Nasdaq ended higher, while the Dow closed lower after a choppy trading session, as investors sifted through a spate of earnings, including Amazon