A Chicago development company will get almost all of the last-minute price cut it sought to buy the bankrupt Philadelphia Energy Solutions, setting the stage for the sale of the 1,300-acre refinery complex to close Friday.

Hilco Redevelopment Partners, which agreed in February to pay $252 million for the property, will get a $26.5 million price cut under a settlement announced Thursday, a nominal reduction from the $27.5 million discount it had sought.

Hilco’s effort to cut the price at the eleventh hour irked two PES creditors, which stand to receive less under the deal. But in the end, the objecting creditors seem to accept that a reduced sales price is better than no deal at all.

“I think this is the right solution at this juncture,” said Paul N. Silverstein, a lawyer representing the two lenders, Marble Ridge Capital LP and Serengeti Asset Management LP, which together are owed more than $80 million from PES. Under the settlement, the creditors dropped their call for the court to reject the price cut and order Hilco to live up to the original purchase agreement.

The sale to Hilco, originally scheduled to close by May 31, was delayed because agreements were not yet in place to outline plans to clean up the property, heavily polluted after more than 150 years of oil processing. Hilco requested the price cut on June 6, saying it needed the discount because of economic uncertainty due to the coronavirus pandemic, increased environmental remediation costs, and the collapse of a waterfront bulkhead that occurred since it won the right to buy the property.

The drama threatened to unravel a complex deal that could set a new course for the refinery, which closed a year ago after a 2019 fire and explosion, putting more than 1,000 employees out of work. Hilco has said it plans to clear much of the refinery property and redevelop the land as a mixed-use industrial complex.

At Thursday’s hearing, U.S. Bankruptcy Judge Laurie Selber Silverstein said she accepted PES’s argument that agreeing to the price cut was a proper exercise of its business judgment — and that the alternative, throwing out the deal and restarting the sale process, would be far costlier.

The two lenders had argued that Hilco intentionally delayed completion of the sale to force a purchase price reduction. Hilco, in a court filing on Thursday, called the creditor’s claim “a false narrative.”

Hilco said that the efforts to negotiate agreements with environmental regulators and Sunoco Inc., a former refinery owner that is responsible for legacy environmental cleanup, were “incredibly time-consuming and expensive.” The Pennsylvania Department of Environmental Protection did not approve Hilco’s soil management plan until June 18, it said.

Hilco also said that it learned only on June 12 that an easement authorizing a significant pipeline to traverse property owned by the city had expired in 2017, and it had to quickly negotiate an agreement with the city committing it to approve a new pipeline license. The pipeline ties a refinery tank farm into other pipelines, connecting the property to fuel sources in the region, and is integral if Hilco or another company continues to operate the fuel-storage units.