A lovely story - the same thing happened to both of my parents....
Many years ago, my dad was very poorly and was about to be readmitted to hospital, which he hated. He died in the night before he was to go in.... we felt it was from choice, but never knew how...
then my mum, like your friend, was dying in a lovely nursing home, but held on until all her children had visited her. She knew she was slipping away, and was happy about it - her time had come. Nature - however it works - is a wonderful thing.