Narrated Anas: We were in the funeral procession of the daughter of Allah's Apostle and Allah's Apostle was sitting near the grave and I saw his eyes full of tears. He said, "Is there anyone amongst you who did not have sexual relations with his wife last night?" Abu Talha replied in the affirmative. And so Allah's Apostle told him to get down in her grave and he got down in her grave and buried her.
Sahih Buckari BooK of funerals number 426
Why is an action of previous night matter while burying someone?