US stocks end lower, with S&P 500 off two straight records. Walmart's weaker outlook and tariff uncertainty hurt sentiment.