Praise be to Allah,
Yazeed ibn Haaroon narrated to us from Humayd at-Taweel from Anas ibn Maalik who said,
“Allah’s Messenger (PBUH) said, ‘You should not admire [the good deeds of] anyone among you until you see how his life would end, for a person may do righteous deeds for a long period of his life, (or maybe he said, ‘for a short period of his life), and if he happens to die in that state he will certainly be admitted into Paradise, but he would give up [such righteous deeds] and start committing bad deeds [and thus dies in that state and goes to Hellfire]. [Conversely,] a person may commit bad deeds for a long period of his life, and if he happens to die in that state he will certainly go to Hellfire, but he gives up [such bad deeds] and starts doing good deeds instead [and thus dies in that state and goes to Paradise]. And when Allah wills good for a person, He puts him into service before he dies.’ They (i.e. his companions) asked, ‘How does He put him into service?’ He said, ‘He guides him to do a righteous deed and then causes him to die in that state.”‘
(Musnad Ahmad, Vol. 3, p. 121. The isnaad of this Hadeeth is Saheeh according to the conditions set by al-Bukhaaree and Muslim.)
Source:
Thulaathiyyaat Musnad Ahmad ibn Hanbal (may Allah have mercy on him)
Reports of Imaam Ahmad that have only three narrators between him and the Prophet, peace, and blessings be upon him.
Shaykh Muhammad ibn Ahmad ibn Saalim as–Saffaareenee al–Hanbalee ~(1114 –1188 AH)