PATRICK WALTERSPHILADELPHIA (AP) â¿¿ The oldest and largest refinery on the East Coast will stay open thanks to a deal between Sunoco and the global asset manager The Carlyle Group, with the groups announcing Monday that they have agreed to terms on a joint venture at the facility. The Philadelphia refinery, which had struggled to make money as the price of imported crude oil rose, was scheduled to close in August. In April, Sunoco announced that it had entered into "exclusive discussions" with Carlyle about a possible joint venture involving the 330,000-barrels-per-day facility, which has about 850 workers. On Monday, the groups announced they had agreed to form Philadelphia Energy Solutions, a joint venture that will enable the facility to continue operating. In a statement, the companies said the agreement will save all of the current refining jobs and create up to 200 more as the refinery is updated and expanded. The deal is expected to close in the third quarter. Financial terms weren't disclosed. "This is the best possible outcome for everyone involved," Brian P. MacDonald, Sunoco's chairman and chief executive officer, said in a statement. "Existing jobs will be saved, new jobs will be created and new business opportunities will be given the chance to develop." Under terms of the agreement, Sunoco will contribute its refinery assets to the joint venture in exchange for a non-operating minority interest. Carlyle will have the majority interest and oversee day-to-day operations, officials said. Carlyle Managing Director Rodney Cohen said the company planned $200 million worth of capital improvements and would bring in a new leadership team. "We are going to explore a range of new energy and chemical businesses," Cohen said on a conference call. "The way to revitalize in this facility is to invest." Gov. Tom Corbett lauded the announcement of the project, which is getting state support. The Pennsylvania Legislature earlier this year approved the creation of a tax-free zone for the site, while the state is offering up to $25 million in construction aid and an offer to issue tax-exempt bonds, Corbett said.