The S&P 500 closed lower on Tuesday while the Nasdaq reached a record high, as investors balanced worries about the slowing pace of economic recovery.