Like others said, you did fine. Make yourself safe, report it, call security if required, but also understand that when people are under extreme duress such as the death of a loved one, they want to blame anyone and anything.
People have a really hard time coping with the fact that people often die without reason, unceremoniously, to such a degree that they feel they have been wronged by something or someone, even if there isn't anything to blame.
When this happens they may pick something they perceive as being in proximity to the event to blame to try to make sense of it. It might be disease, the equipment, the medication, a family member, or in this case yourself.
You deal with this by knowing the facts of what happened, and knowing you did your best and aren't to blame, and by understanding that people lash out when they are upset.
Nothing you could have said would have helped the situation with this person in their state, so saying nothing and leaving to de-escalate the situation is 100% the best thing you could have done.