Don't blame Amazon for the death of Toys "R" Us.

It's true, online shopping didn't help matters, but the struggles of Toys "R" Us predate the boom in online shopping. Many of its wounds were self-inflicted.

The company's biggest problem: It was saddled with billions of dollars in debt. That debt stopped it from making the necessary investment in stores. And that meant an unpleasant shopping experience that doomed the chain. The company told employees Wednesday that it would close or sell its US stores after 70 years in business.

"If you're going to have that breadth of inventory, you need someone in the store to help you find it, help you experience it," said Greg Portell, lead partner at retail consultant A.T. Kearney. "It's hard to sell toys in a cold, warehouse environment."

Even Toys "R" Us CEO David Brandon conceded in an SEC filing last fall that the company had fallen behind competitors "on various fronts, including with regard to general upkeep and the condition of our stores."

Related: Toys 'R' will close or sell all US stores

Toys "R" Us' debt problems date back to well before Amazon (AMZN) was a major threat. Its debt was downgraded to junk bond status in January of 2005, at a time when Amazon's sales were just 4% of their current level.

A year later the company was taken private by KKR, Bain Capital and real estate firm Vornado. The $6.6 billion purchase left it with $5.3 billion in debt secured by its assets and it never really recovered.

The toy store faced several other big challenges at about the same time. There was the rise of big box retailers like Walmart (WMT), which now dwarfs Toys "R" Us in total toy sales. Last year toymakers Mattel (MAT) and Hasbro (HAS) each sold about $1 billion worth of their toys at Walmart, more than twice as much as what they sold through Toys "R" Us. Target (TGT) sold just about as many of their as Toys "R" Us last year.

And like most retailers, Toys "R" Us also lost sales to online rivals such as Amazon that offered lower prices and quick shipping.

But much of the chain's resources were devoted to paying off that massive debt load rather than staying competitive.

When Toys "R" Us filed for bankruptcy in September 2017, it disclosed it had about $5 billion in debt and was spending about $400 million a year just to service that debt.

That burden crowded out critical strategic priorities, like making its stores a nice place to shop and paying employees.

Do you work at Toys "R" Us? We want to hear from you

Brandon said in a filing last fall that the bankruptcy process would allow it to invest $65 million in its stores. The company hoped to add playrooms where kids could try out toys and spaces for birthday parties, but it never got the chance.

Brandon also vowed to spend more money on staff. With extremely low unemployment, competitors like Walmart are raising wages, while Toys 'R' Us was having trouble attracting the kind of help it needed. It said last fall it would spend $72 million from 2018 to 2021 to raise starting wages and to reward and keep its most effective employees.

"Better employees make for happier customers," Brandon said in the filing.

Despite sharply declining sales, Toys "R" Us was also extremely late to the game in closing stores. At the time of its bankruptcy filing, the chain had 1,697 stores -- more than it had ever had.

In January, it announced plans to shut 182 US stores. Last month it filed for the equivalent of bankruptcy for its UK operations, where it had 105 locations. On Wednesday, hours before announcing the decision to close its US operations, it said it would close the last 75 UK stores.

But the closings in recent weeks were far too little, too late. And as a result, now all of US stores will close, and probably most foreign stores as well.