TOKYO (Reuters) - A consortium led by Western Digital Corp WDC.O is close to an agreement to buy Toshiba Corp's 6502.T $17.4 billion chip business, with the U.S. firm's CEO in Tokyo to finalize the long and contentious talks, a person familiar with the matter said.

FILE PHOTO: A logo of Toshiba Corp is seen on a printed circuit board in this photo illustration taken in Tokyo July 31, 2012. REUTERS/Yuriko Nakao/File Photo

The consortium and Toshiba aim to announce a deal on Thursday when the board of the embattled Japanese conglomerate is due to meet, separate people familiar with the matter also said.

A deal would mark an end to months of uncertainty for Toshiba, which is scrambling to sell its flash memory unit - the world’s No. 2 producer of NAND chips - to cover billions in losses at its bankrupt U.S. nuclear business Westinghouse.

It would also be a remarkable victory for Western Digital, Toshiba’s joint venture partner for its chip business, after relations with the Japanese firm frayed to point where other bidders were chosen first and the U.S. firm initiated legal action that threatened to derail any deal.

Sources declined to be identified as the discussions were private.

Western Digital, Toshiba and a state-backed fund, the Innovation Network of Japan, which is a member of the consortium declined to comment. Representatives for U.S. private equity firm KKR & Co KKR.N and the Development Bank of Japan, also members, were not immediately available for comment.

While Western Digital is very much in the driver’s seat in talks, it has made several key concessions to secure a deal that Toshiba is willing to accept and that will keep the unit out of the hands of rival chip firms, sources have said.

Its financial participation in the deal is limited to 150 billion yen ($1.4 billion) through convertible bonds, and its stake will be no more than a third when those bonds are converted, they said. A stake of more than a third would allow Western Digital to veto board decisions.

The U.S. firm will also not seek a management role, they said.

Other members of group, which is offering 1.9 trillion yen ($17.4 billion), will include the Innovation Network Corp of Japan and the Development Bank of Japan as well as KKR, with each putting up 300 billion yen, they said. Japanese banks and companies will also provide financing.

But it remains to be seen if a deal will be concluded by Thursday. Some senior executives at Toshiba Memory have threatened to quit if a deal with Western Digital is struck, sources say.

Both sides, however, have reason to cooperate.

Toshiba wants to close the sale by the end of the financial year in March to ensure it is not in negative net worth, where its liabilities exceed assets, for a second year running. This could result in a delisting from the Tokyo Stock Exchange.

Given regulatory approvals could take more than six months, Toshiba has been hoping to reach a deal by the end of the month to ensure it can close the sale in time.

For its part, Western Digital is eager to keep investing in their joint venture to keep up with industry leader Samsung Electronics 005930.KS, which recently announced 20.4 trillion won ($18.2 billion) of new investments into NAND production lines.

The U.S. firm, which has taken legal action against Toshiba arguing that any deal will need its consent, only appeared to gain the upper hand in talks over the past month.

Before that, Toshiba had picked a consortium of Japanese government-backed funds, U.S. private equity firm Bain Capital LP and South Korean chip maker SK Hynix Inc 000660.KS as its preferred bidder.

Shares in Toshiba ended trade on Monday up 0.6 percent. It has lost around 30 percent in market value since late last year when the company flagged that its Westinghouse division was facing billions in losses.