NEW YORK (AP) — Sears is confirming reports its chairman and largest shareholder Eddie Lampert’s hedge fund has won a bid to buy roughly 400 stores and other assets for $5.2 billion.

The move, announced Thursday, preserves 45,000 jobs and is subject to court approval on Feb. 1. Creditors will have the opportunity to object before then.

The deal will then close Feb. 8.

The agreement follows marathon negotiations that started early Monday as Lampert was fending off demands from creditors who were pushing for liquidation.

Lampert’s ESL Investments was the only one to put forth a proposal to rescue the floundering company in its entirety. He had sweetened his bid multiple times.

Still, many experts believe a smaller version of the retailer will not be viable as it faces increasing competition.