U.S. stocks ended the week with a whimper, turning big opening gains in the S&P 500 and Nasdaq Composite into losses by the conclusion of Friday’s session.

A sharp selloff in biotech and health-care stocks spread to broader markets, weighing on sentiment.

All three main indexes booked weekly losses, even as the Dow Jones Industrial Average eked out a gain on Friday, largely thanks to a 8.9% jump in Nike Inc. shares, which contributed 68 points to the blue-chips benchmark.

“A selloff in biotechs took the wind out of the rally. And in this low-volume environment traders are selling first and asking questions later,” said Ryan Larson, head of equity trading, U.S. RBC Global.

The iShares Nasdaq Biotechnology ETF IBB, +0.76% plunged 4.9%, wrapping a bruising week for the sector with a 13% weekly loss. The S&P 500 health-care sector lost 5.8% over the week and closed below the lows reached on Aug 24.

Read: Biotech stocks post biggest weekly decline in 7 years

“The health-care sector closed below the Aug. 24 lows. It does not bode well for sentiment when a former leader in the market is now leading on the downside,” Larson said.

The S&P 500 SPX, +1.05% closed less than a point lower at 1,931.34 and booked a 1.4% weekly loss. Utilities, consumer staples and financials booked weekly gains, as investors turned to defensive sectors.

The Dow Jones Industrial Average DJIA, +0.51% had been up by as many as 250 points, but closed 113.35 points, or 0.7%, higher at 16,314.67 and declined 0.4% over the week. Caterpillar Inc CAT, +1.25% led laggards this week, posting a 9.6% loss as the machinery giant plans to lay off 10,000 employees by end of 2018.

The Nasdaq Composite COMP, +1.71% ended the day down 47.98 points, or 1%, at 4,686.50 and posted a 2.9% weekly loss. Biotechs weighed heavily on the index, as the sector got hammered this week.

The main indexes declined in six of the past seven sessions, since the Federal Reserve left its key borrowing rate unchanged on Sept 17, citing concerns over slowing global growth.

Earlier on Friday sharp gains were attributed to optimism after Federal Reserve Chairwoman Janet Yellen’s hawkish comments late Thursday, when she said the economy is strengthening and an interest-rate hike is likely before the end of the year.

Stock markets in Europe rallied after Janet Yellen’s comments, with the benchmark index SXXP, +0.20% closing 2.8% higher.

“Prospects for the U.S. economy generally appear solid,” Yellen said in a speech after U.S. markets had closed. Signs of weak growth overseas won’t prove large enough to have a significant impact on policy, the Fed chairwoman said in remarks that were briefly upstaged when she faltered and appeared to feel ill.

In economic reports, revised data on second-quarter U.S. growth appeared to underline Yellen’s view. Data showed that the economy grew faster than first estimated, driven by higher consumer spending and somewhat stronger business investment.

A surprise announcement by House Speaker John Boehner that he is resigning from Congress next month appeared to briefly taper the rally. But some say this move could help avert a government shutdown on Oct. 1.

Other markets:Asian equities ended mixed, while crude oil CLX25, gained 1.8% to $45.70 a barrel and climbed 2.3% on week. The dollar DXY, +0.14% index advanced, up 0.2% to 96.19. Gold US:GCZ5 pulled back on Friday, settling 0.7% lower at $1,145.60, but recorded a 0.7% weekly gain.

Economic reports: The U.S. economy grew at an annual 3.9% pace in the second quarter instead of 3.7%, revised government data show.

Consumer sentiment for September was revised higher to 87.2, from a preliminary reading of 85.7, as measured by the University of Michigan. But it is still below the August level.

Stocks to watch: Shares in Nike Inc. NKE, +3.08% surged 8.9% after the company late Thursday reported better-than-expected sales, that were driven by a jump in revenue in China. Said one analyst note: “Nike just smoked it.”

Caterpillar Inc. CAT, +1.25% fell 1.3% and was one of the four decliner on the Dow. The machinery giant announced Thursday that it is cutting thousands of jobs due to weak demand.