U.S. stock indexes closed mostly higher Thursday after a late stumble pulled the S&P 500 just short of its third straight all-time high.

The benchmark index slipped 0.1% after spending much of the day higher. It’s on track for its second weekly gain as Wall Street continues to coast following its rocket ride last month powered by hopes for coming COVID-19 vaccines. The Nasdaq composite set a record high for the second straight day. Treasury yields mostly declined, a reversal from earlier in the week.

A few reports on the economy that were better than expected helped support stocks. One showed that growth in the U.S. services sector, including health care and retail, was slightly stronger last month than economists expected. A separate report said fewer U.S. workers filed for unemployment benefits last week than forecast, though economists cautioned the number may have been distorted by the Thanksgiving holiday.

Investors have also been encouraged this week by signs that Democrats and Republicans in Washington may get past their bitter partisanship to reach a deal to provide more financial support for the economy. House Speaker Nancy Pelosi and Senate Majority Leader Mitch McConnell spoke Thursday, a day after Pelosi signaled a willingness to make major concessions in search of a coronavirus rescue package. President-elect Joe Biden urged Congress on Wednesday to pass a relief bill now, with more aid to come next year.

“There’s a lot of optimism being built into the market right now,” said Sam Stovall, chief investment strategist at CFRA. “Investors are sort of keeping their fingers crossed that we come up with a stimulus package, no matter the size.”

The S&P 500 slipped 2.29 points to 3,666.72. The Dow Jones Industrial Average gained 85.73 points, or 0.3%, to 29,969.52. The Nasdaq composite added 27.82 points, or 0.2%, to 12,377.18. Small company stocks made out better than the broader market. The Russell 2000 index picked up 10.67 points, or 0.6%, to 1,848.70.