The Messenger of Allah ﷺ said, "Every deceased person has their deeds sealed off, except for the one who dies as a guard stationed at the frontier in the path of Allah. His deeds continue to grow for him until the Day of Resurrection, and he is safe from the trial of the grave."
قال رسول الله ﷺ: كل ميت يختم على عمله إلا الذي مات مرابطا في سبيل الله، فإنه ينمى له عمله إلى يوم القيامة، ويأمن من فتنة القبر.
Abu Dawud (2500), Tirmidhi (1631), and Ahmad (23951) narrated it, and Ibn Hibban (4624) and Hakim (2/79, 144) graded it sahih, all of them by way of Haywa bin Shurayh (who is the Egyptian), who said, Abu Hani Humayd bin Hani Khawlani informed me, that Amr bin Malik Janabi informed him, that he heard Fadala bin Ubayd, and he related it. Its isnad is sahih. This was mentioned earlier in the Book of Funerals, in the chapter on guarding the frontier for the sake of Allah as protection from the punishment of the grave.