U.S. stocks closed sharply lower Wednesday as a shooting in Southern California added to investor jitters about rising interest rates and oil prices that dipped below $40 a barrel. The Dow Jones Industrial Average and Standard & Poor's 500 index had fallen sharply earlier in the day, led by drops in energy shares, after comments by Federal Reserve Chair Janet Yellen suggested the U.S. central bank may be ready to raise rates.

The Nasdaq fell into negative territory, despite record highs in Alphabet, Amazon and Netflix. Yahoo jumped after reports the company could sell its core Internet business.

The energy index was down 3 percent as U.S. crude oil futures hit a two-week low below $40 a barrel. The utility index was down 2 percent. Utilities tend to underperform in a higher-rate environment.

In prepared remarks to the Economic Club of Washington, Yellen said she was "looking forward" to a rate hike that would be seen as a testament to the economy's recovery from recession. She did not indicate if she still expected an increase would be warranted at the Fed's policy meeting Dec 15-16.

Yellen also expressed confidence in the U.S. economy. Earlier in the day, data showed U.S. private employers boosted hiring in November. The U.S. government monthly jobs report is due Friday.

"I was a little surprised she sounded as hawkish as she did given we're two days away from the non-farm payrolls report and a couple of weeks away from the Fed FOMC meeting," said Michael O'Rourke, chief market strategist at JonesTrading in Greenwich, Connecticut. "The market is still digesting a couple of different things."

The Fed said in its Beige Book report of anecdotal information on business activity collected from contacts nationwide that the U.S. labor market tightened modestly in recent weeks with some upward pressure on wages.

Yellen also is due to testify on the economic outlook before a joint congressional committee Thursday.

Shares of Amazon touched a record high of $684.82, while those of Netflix rose as much as 4.8 percent to $131.35.

Airline shares rose after Delta Air Lines said it earned more per mile in November than a year ago.