NEW YORK – A late sell-off wiped out the stock market’s gains Thursday as the stalemate over raising the country’s debt limit continued.

The market had been up for much of the day after an unexpected decrease in new applications for unemployment benefits. Stocks sank in the last half-hour of trading after Senate Majority Leader Harry Reid said that a bill to end the stalemate, proposed in the House of Representatives, would fail if it reached the Senate.

“That gave a catalyst for selling,” said Quincy Krosby, market strategist at Prudential Financial.

The Dow has fallen five straight days because of worries that the U.S. might default on its debt if Congress doesn’t raise the country’s borrowing limit. It’s down more than 484 points, or 3.8 percent. Just five days remain until the Treasury Department says the government won’t have enough money to cover all of its bills.

Even if the U.S. doesn’t default, investors worry that the country might lose its triple-A credit rating. That could raise interest rates and possibly slow the U.S. economy, which is still recovering from the worst recession in decades.

“We’re running out of time,” said Phil Dow, director of equity strategy at RBC Wealth Management in Minneapolis. “It’s getting scary.”

The chief executives of several of the country’s largest banks sent a letter to The White House and to Congress urging a quick resolution to the debt limit debate. Bank of America Corp.’s Brian Moynihan, JPMorgan Chase & Co.’s Jamie Dimon, and Goldman Sachs Group Inc.’s Lloyd Blankfein and others warned on Thursday that the consequences on not acting would be grave for the economy, the job market, and for America’s global economic leadership.

The Dow Jones industrial average fell 62.44 points, or 0.5 percent, to close at 12,240.11. The index had been up as many as 82 points earlier in the day.

The Standard & Poor’s 500 fell 4.22, or 0.3 percent, to close at 1,300.67. The S&P 500 has four straight days. The Nasdaq composite index was up 1.46, or 0.1 percent, to 2,766.25.

The price of gold, which tends to rise when investors are fearful of economic disruptions, fell $1.70 to $1,613.40 an ounce. Gold is up $100 an ounce in the last two weeks and nearly $200 an ounce since the beginning of the year, when it traded at $1,422 an ounce. When gold prices are high, experts say it’s a good indicator that people are reluctant to invest in other markets.

The dollar rose against other currencies. Treasury prices were also up slightly.