Fiqh-us-Sunnah Volume 4, Funerals and Dhikr, Fiqh 4.015.

Section : Good Deeds Prior to Death: An Indication of a Good End.

Anas reported that the Prophet, peace be upon him, said: “When Allah intends good for a servant of His, He uses him for good.” They asked: “How does Allah use him?” The Prophet, peace be upon him, replied: “He enables him to do good deeds and makes it easy for him before his death and then causes him to die while he is in that state of goodness.” (Ahmad, Tirrnizhi, Al-Hakim, and Ibn Hibban)