The logo of Toshiba Corp is seen at the company's facility in Kawasaki, south of Tokyo, Japan February 28, 2017.

Troubled Japanese conglomerate Toshiba agreed on Wednesday to sell its prized memory business to a consortium led by Bain Capital Private Equity.

Toshiba, the world's second-largest producer of NAND memory chips, said the deal was worth about 2 trillion yen ($18 billion). The deal could potentially help Toshiba plug a hole left in its finances following the bankruptcy of U.S. nuclear unit Westinghouse. The conglomerate was also facing the threat of being delisted from the Tokyo Stock Exchange.

A person familiar with the matter said Toshiba will reinvest 350.5 billion yen into the holding company that is set up by the Bain-led consortium to buy shares of the memory business.

The source also said that as of Wednesday, the Bain-led consortium comprised Toshiba, Japan's Hoya Corp., South Korean chipmaker SK Hynix, U.S. buyers of Toshiba chips Apple and Dell, memory product maker Kingston Technology and data storage firm Seagate Technology.

Toshiba's months-long attempt to sell the chip business was complicated by its partners and changing alliances among its suitors.

Previously, Reuters reported that Toshiba was shifting back toward selling the business to a group backed by its joint venture partner Western Digital.

Meanwhile, Western Digital said it was taking fresh legal steps to stop Toshiba from unilaterally investing in a new flash memory production line.

A new request for arbitration was filed with the International Court of Arbitration in a bid to stop Toshiba from investing in the so-called Fab 6 facility in Yokkaichi, Japan, without giving Western Digital subsidiary SanDisk the "opportunity to make a comparable investment."

"It is unfortunate that SanDisk is forced to initiate binding arbitration to remedy Toshiba's retaliatory breach of the JV agreement entered into by both SanDisk and Toshiba," Western Digital said in a statement. Several of the company's SanDisk subsidiaries previously filed arbitration requests in May and July.

But people familiar with the matter said that even if Western Digital were to win an injunction regarding the litigation tied to the joint venture, the sale of Toshiba's memory chip business was still expected to go through.

Last week, Toshiba said it had entered into a non-binding memorandum of understanding with Bain Capital Private Equity to negotiate a "mutually satisfactory definitive agreement" for the sale of the chip business by the end of the month.

Toshiba said it had been negotiating with three potential groups to sell its memory business. One consortium included Bain Capital, the Innovation Network Corporation of Japan and the Development Bank of Japan. Another included Western Digital and a third involved iPhone assembler Hon Hai Precision Industry.

During negotiations, Toshiba said Bain had come forward with a new proposal and that its board of directors "determined to continue negotiations with the Bain-led consortium on the basis of this new proposal."

Analysts have previously said the sale of the memory business could be key to turning around the broader business.