Leave her be her depressed, emotional and unhappy self. With you out of the picture she gets to find out that you are not responsible for her mess. As for her behavior towards you apologize once and leave it at that. No need for text apologizing. And the next time she shows up to your place unannounced, then you give W the same message she gave you. But in a more cordial manner.