Allen, I think it's well documented with some humans who are in much the same situation as Kelly that when they are about to go, they somehow get energized, more coherent and behave much like their old selves. It sounds to me like Kelly was ready and that your timing couldn't have been better. I hope you are taking comfort in knowing she was as happy as she could be in her final hours even though there is an emptiness around the household right now.
Ralph
Ralph