U.S. stock indexes closed slightly lower Thursday after a day of mostly choppy trading, wiping out some of the market’s gains from a day earlier.

Technology stocks took some of the worst losses. Fast-food chains and other consumer-focused companies, utilities and banks also declined, outweighing gains in energy and industrial stocks. Small-company stocks fared better than the rest of the market.

The indexes veered solidly into the red by late afternoon ahead of a new round of trade talks between the U.S. and China. The countries have threatened tariffs on each other.

“Now that we’re making it out of earnings season, geopolitical is going to come back into the forefront of what the market’s concerns are,” said Shawn Cruz, manager of trader strategy at TD Ameritrade. “And that may continue to drive intraday volatility until we get more certainty as far as what is actually going to come out of these trade talks.”

The S&P 500 index slipped 2.33 points, or 0.1 percent, to 2,720.13. The Dow Jones industrial average lost 54.95 points, or 0.2 percent, to 24,713.98. The drop pulled the Dow into the red for the year. The Nasdaq composite fell 15.82 points, or 0.2 percent, to 7,382.47.

The Russell 2000 index of smaller-company stocks bucked the downward trend, setting an all-time high for the second day in a row. The index picked up 8.92 points, or 0.6 percent, to 1,625.29.

Small-cap companies tend to be more focused on business in the U.S., rather than overseas, which may make them more attractive to investors worried about a trade war or rising interest rates.

“The concern is on the geopolitical front, that’s why you’re seeing the large-cap, the multinationals, really getting hit by this,” Cruz said.

The Trump administration was scheduled to resume talks in Washington with senior Chinese officials seeking to ward off a trade war between the world’s two biggest economies. But while fielding questions from reporters Thursday afternoon, Trump suggested the talks may not end up averting a trade war with China: “Will that be successful? I tend to doubt it,” Trump said.

Investors took note of the remarks and the market indexes moved lower after spending much of the day wavering between small gains and losses.

The Trump administration has proposed tariffs on up to $150 billion in Chinese products to punish Beijing for forcing American companies to turn over technology in exchange for access to the Chinese market. China has countered by targeting $50 billion in U.S. products. Neither country has imposed the tariffs.

The latest quarterly results and outlooks from several companies also put investors in a selling mood.

J.C. Penney sank 12.4 percent to $2.69 after the struggling department store chain said it might take a loss in 2018 as it cut its annual forecast. Jack in the Box lost 8.3 percent to $83.79 after the burger chain’s earnings fell short of analysts’ expectations.

Cisco Systems led a slide in technology stocks after the seller of routers, switches and software’s latest quarterly results disappointed traders. The stock slid 3.8 percent to $43.46.

Dillard’s bucked the trend with earnings that exceeded Wall Street’s estimates. The department store chain climbed 6.3 percent to $76.53.

CBS slid 4.1 percent to $51.61 after a Delaware judge refused Thursday to grant the company a restraining order against its majority shareholder. CBS had sought to prevent Shari Redstone’s National Amusements from thwarting a board vote on a dividend that would dilute National Amusements’ voting power, effectively giving CBS independence.

An early rally in crude oil faded by late afternoon. Benchmark U.S. crude oil ended flat at $71.49 a barrel in New York. Brent crude, used to price international oil, rose 2 cents to close at $79.30 a barrel in London. It had been briefly above $80 a barrel, its highest level since November 2014.

Energy stocks notched solid gains. Valero Energy gained 4.1 percent to $119.71.

Williams Partners jumped 8 percent to $41.49 after it agreed to be acquired by oil pipeline company Williams Cos. in an all-stock deal they valued at $10.5 billion.

Bond prices fell. The yield on the 10-year Treasury rose to 3.11 percent from 3.10 percent late Wednesday.

The dollar rose to 110.75 yen from 110.25 yen on Wednesday. The euro weakened to $1.1799 from $1.1802.

Gold fell $2.10 to $1,289.40 an ounce. Silver added 11 cents to $16.48 an ounce. Copper gained 2 cents to $3.09 a pound.

In other energy futures trading, heating oil rose a penny to $2.28 a gallon. Wholesale gasoline fell a penny to $2.24 a gallon. Natural gas gained 4 cents to $2.89 per 1,000 cubic feet.

Major stock indexes in Europe finished higher Thursday. Germany’s DAX gained 0.9 percent, while France’s CAC 40 rose 1 percent. Britain’s FTSE 100 added 0.7 percent. Major indexes in Asia ended mostly lower. Japan’s Nikkei 225 index added 0.5 percent. Hong Kong’s Hang Seng fell 0.5 percent. The Kospi in South Korea slid 0.5 percent.

© The Associated Press. All rights reserved.