S&P, Nasdaq rebound as US stocks end mixed