A deal was struck between Sears (SHLDQ) and Chairman Eddie Lampert early Wednesday morning to save the company and its roughly 400 store locations.

The now almost $5.2 billion deal came after negotiations with law firm Weil, Gothsal & Manges as Lampert worked to save Sears from bankruptcy through his hedge fund ESL.

The new deal from Lampert could save up to 50,000 jobs as the company was facing liquidation at auction Tuesday. Lambert’s bid was the only one on the table to save Sears from closing for good.

A bankruptcy judge instructed Sears advisors to wrap up the deal with ESL and Lampert, which prompted advisors to work on a solution that came at 2 a.m. on Wednesday, CNBC reported. The new offer from ESL includes an additional $150 million and the assumption of more liabilities, according to Reuters.

However, despite Lampert securing the deal to save Sears, the company’s unsecured creditors are not satisfied with the bid, the CNBC reported. The unsecured creditors can still object to the bid, which would require a bankruptcy judge to intervene on Jan. 31. A bankruptcy judge needs to sign off on the deal for it to finally become official.

Sear’s, which has not turned a profit since 2010, still has an uphill battle as it needs to figure out a strategy to remedy its business revenue issues. It is unknown if Lampert’s deal will save the 425 Sears and Kmart stores that remain open.

Sears filed for bankruptcy in October and after rejecting Lampert’s first bid of $4.4 million gave the chairman time to submit a more substantial offer to help the company emerge from bankruptcy.

As of 12:11 p.m. ET, Sears stock was up 45.45 percent.

Sears Bid Accepted
Sears Chairman Eddie Lampert's bid to save the company from liquidation was accepted in the early morning hours Wednesday. A Sears sign is displayed at a store on October 15, 2018 in the Brooklyn borough of New York City. The iconic American retailer has filed for Chapter 11 protection from creditors early on Monday, listing more than $10 billion in debts and more than $1 billion in assets. Getty Images/Spencer Platt