Mishkat al-Masabih
Ibn ‘Umar reported God’s messenger as saying, “God accepts a servant’s repentance till he gives up his spirit in death.”* *The Arabic is ma lam yugharghir, which might, be translated literally "as long as he has not died with the death rattle in his throat." Tirmidhi and Ibn Majah transmitted it.
وَعَنِ ابْنِ عُمَرَ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِنَّ اللَّهَ يَقْبَلُ تَوْبَةَ الْعَبْدِ مَا لَمْ يُغَرْغِرْ» . رَوَاهُ التِّرْمِذِيُّ وَابْن مَاجَه
Reference