The Japanese electronics giant warns of a $6.3-billion write-down and said its chairman was resigning.