I have a coworker I've become very close friends with over the past year. This friendship extends beyond just the workplace, and we are involved in each others lives outside of work. However, we sit next to each other, which makes it difficult to avoid conflicts when they arise.
Over the past couple of months, she and I have both had hardships in our personal lives that have affected how we communicate with each other. Recently, we had the following interaction:
Her: (venting about an upsetting social interaction with a friend)
Me: That sucks. All you can really do is focus on what you can control, and try not to let this person get to you as much.
Her (angrily): I'm just trying to vent to you. I'm not "letting it get to me!"
Me: I'm sorry. You've just been talking about it a lot, so it seems like it's something that is definitely weighing on you.
Her: Well, it's not! I guess I just can't talk to you about this.
Because I felt upset with her response to what I had intended to be a supportive comment, I told her I wanted space to gather my feelings and thoughts alone before we addressed why our interaction had gone sour.
She did not feel the same way. I went back to my desk and began working, to which she sent me texts calling me immature and uncaring for not wanting to resolve our miscommunication issue right then and there. I could also see her watching me to see if I was ignoring her texts, since my phone sits on my desk. This ended up making me even more upset, because it felt like I was being bullied into a talk I wasn't prepared for.
Although this eventually got resolved and I explained to her why I did not yet want to communicate, I feel like she did not truly understand why I needed space before addressing our miscommunication and that this is likely to happen again.
If / When this does happen again, what is the best way I can iterate to her that my request for space is something I have a necessity for when addressing highly emotional situations while minimizing the chance that she will take it offensively?
Edit for clarity:
I am aware of why she was hurt, and how I could have better handled my end of the communication. What I'm mostly concerned for is how I can address the need for me to excuse myself from confrontations until I have had time to calm down, think about why both parties are upset, and figure out what I'd like to do to make it right.
When I am forced to address a confrontation while still emotionally upset (in this case, I didn't understand yet why she was angry with me), I feel like I don't actually get to express my emotions because I haven't had time to reflect on them. This often leaves the other party feeling as though they've "said their piece", but leaves me finding the words to express my emotions hours later after I've had time to reflect on the situation.
What I would like is advice on how to politely tell someone that I need time to myself before addressing an argument, without escalating the problem even further.