The S&P 500 turned in its third consecutive day of gains Wednesday while the Nasdaq Composite fell as Amazon stock dropped after CEO Jeff Bezos announced he would step down.