“Whoever makes a will as death approaches, and his will is in accordance with the book of Allah (SWT) it will be an expiation for whatever he did not pay of his Zakah during his lifetime.”
Sunan Ibn Majah Book 22, Hadith 11