It’s been a tempestuous period for The Weinstein Company, which had to be sold after numerous sexual harassment and assault claims were brought against its founder Harvey Weinstein, but a deal which has met the approval of the New York Attorney General has been secured.

Maria Contreras-Sweet announced that a deal was reached for the investor group she and billionaire Ron Burkle (a friend of the Weinstein brothers who invested in some of their films) led to buy the film and TV production company after a sit-down between all sides along with New York State Attorney General Eric Schneiderman.

The news was confirmed by the board of The Weinstein Co.

The $500m sale, which rescues TWC from having to declare bankruptcy, is expected to take 40 days to close, presuming there aren't any hindrances. The buyers will assume $225 million in debt.

The sale will save 150 jobs and the transaction includes an $80m compensation fund for victims of Harvey Weinstein. One of the conditions of the deal going through is that Harvey Weinstein will not benefit financially from the sale.

“The deal provides a clear path for compensation for victims and protects the jobs of our employees,” the TWC board said in a statement. “We consider this to be a positive outcome under what have been incredibly difficult circumstances.”

Schneiderman also gave the deal his blessing after serving as an official mediator of sorts, saying in a statement, “As part of these negotiations, we are pleased to have received express commitments from the parties that the new company will create a real, well-funded victims' compensation fund, implement HR policies that will protect all employees, and will not unjustly reward bad actors. We will work with the parties in the weeks ahead to ensure that the parties honor and memorialize these commitments prior to closing.”

Sweet, who is a former senior official in Barack Obama’s administration, said that her involvement was inspired by the #MeToo movement that followed the Weinstein allegations.

“I have had a long-standing commitment to fostering women ownership in business,” she said. “This potential deal is an important step to that end. The cornerstone of our plan has been to launch a new company that represents the best practices in corporate governance and transparency.”

The Weinstein Company will be renamed and hire a new board of directors, the majority of which will be women.