Often what triggers anger is envy, observing something that one can no longer do because of new physical limitations, or something cherished that one will not be able to experience after one's life is over.
One can often make a deal in order to get what is wanted. This is a consistent strategy that's almost always worth trying during life, and when faced with something as strikingly negative as death, it's only natural to use that strategy which has succeeded so many times before.
Often this occurs in wanting to do a particular thing one last time, as in the opera singer who wishes to perform just once more, or the mother who wants in all the world to see her last son get married .
Having to think about finances, family's emotions, medications, examinations, and a world of other issues is overwhelming. Self-esteem is added into the mix when it's called into question by deteriorating physicality.
Just as when one cries and is filled with sorrow at a loved one's end, so does one who is dying themselves. And in the same manner, it acts as emotional cleansing, necessary to the path of eventual acceptance.