NEW YORK (CBSDFW.COM/AP) – Plano-based J.C. Penney is on course to emerge from bankruptcy by Thanksgiving, after a U.S. bankruptcy court approved the sale of the ailing 118-year-old retailer to its two largest landlords and its primary lenders.

The U.S. Bankruptcy Court for the Southern District of Texas approved a purchase agreement, announced earlier this fall, that has substantially all of J.C. Penney’s retail and operating assets acquired by Brookfield Asset Management Inc. and Simon Property Group through a combination of cash and new term loan debt.

READ MORE: Border Patrol Agents Arrest Convicted Child Sex Offender And Convicted Murderer In Rio Grande Valley

The approval followed a lengthy court hearing on Monday.

Still, the retailer faces an uphill battle to attract shoppers this holiday season as they stay away from the malls and stores for safety reasons and shop online more.

Meanwhile, Amazon and big discounters like Walmart and Target are only getting stronger as they offer low prices and one-stop shopping.

J.C. Penney filed for Chapter 11 in May, becoming one of the largest retailers to do so during the pandemic amid a wave of store closures forced by the spread of COVID-19 infections in the U.S.

More than two dozen retailers have filed for bankruptcy protection since the pandemic temporarily closed stores, restaurants, gyms and other businesses nationwide.

READ MORE: Dallas Man Sentenced In Crash That Killed Mississippi Woman, After Admitting To Driving Drunk

Retailers are worrying about the effects on their business with a surge of new cases all over the country.

The chain will shed nearly a third of its stores in the next two years as it restructures, leaving just 600 locations open.

With no other valid offers in sight, Penney’s fate was hanging by the wire. Its financing agreement expires on Nov. 16 and the sale had to close by Nov. 20 to avoid going out of business.

“Our goal from the beginning of this process has been to ensure J.C. Penney will continue to serve customers for decades to come and this court approval accomplishes that objective,” said Jill Soltau, CEO of J.C. Penney, in a statement.

(© Copyright 2020 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)

MORE FROM CBSDFW

MORE NEWS: Odessa Police Investigating After Men Steal Large Toy Turtle From Indoor Playground