(Reuters) — Japan’s Toshiba said on Thursday it had signed an $18 billion deal to sell its chip unit to a consortium led by Bain Capital LP, overcoming a key — albeit not its last — hurdle as it scrambles for funds to stave off a potential delisting.

The sale of the unit — the world’s second biggest producer of NAND chips — was agreed last week after a tortuous auction process but the signing was delayed because consortium member Apple demanded new terms on chip supply, sources familiar with the matter have said.

The deal will see Toshiba reinvest in the unit and together with Hoya, a medical technology firm that also makes parts for chip devices, Japanese firms will hold more than 50 percent of the business — a keen wish of the Japanese government.

A Japanese state-backed fund and bank have also expressed their interest in investing in the future subject to certain conditions, Toshiba said in a statement.

“With this deal, a lot of risks for Toshiba have disappeared. It can go back to being a normal company,” said Hideki Yasuda at Ace Research Institute.

Pressure from the Japanese government, changing alliances among suitors and a slew of revised bids has drawn out the auction over nine months — heightening the risk that the deal may not close before the end of Japan’s financial year in March as regulatory reviews usually take at least six months.

If the deal does not close before then, Toshiba — hurt by liabilities at its now bankrupt nuclear unit Westinghouse — is likely to end a second consecutive year in negative net worth, putting pressure on the Tokyo Stock Exchange to strip it of its listing status.

The sale also faces legal challenges from Western Digital, Toshiba’s chip venture partner and rejected suitor, which is seeking an injunction to block any deal that does not have its consent.

Western Digital, one of world’s leading makers of hard disk drives, paid some $16 billion last year to acquire SanDisk, Toshiba’s chip joint venture partner since 2000. It sees chips as a key pillar of growth and is desperate to keep the business out of the hands of rival chipmakers.

In addition to Apple, Bain’s consortium includes South Korean chipmaker SK Hynix, as well as Dell, Seagate Technology, and Kingston Technology.

Under the deal, Toshiba will hold 40.2 percent of voting rights in the chip unit and Hoya will own 9.9 percent, while other members will hold a combined 49.9 percent, according to SK Hynix.

In a move to address anti-trust concerns that may come up in a regulatory review. Toshiba said SK Hynix would be firewalled from accessing proprietary information that belonged to the chip unit and would not be permitted to own more than 15 percent of voting rights for 10 years.

(Reporting by Makiko Yamazaki; Additional reporting by Kentaro Hamada and Taro Fuse; Editing by Edwina Gibbs)