NEW YORK — The S&P 500 and Nasdaq hit record closing highs Tuesday as AI-fueled optimism offset anxiety over Middle East peace talks — concerns that were compounded by recent U.S. strikes on Iran.