Shomer for the Dead
Question
Answer
Shalom!
Thank you for your question.
Indeed, there is a requirement to ensure that someone is present with the deceased until burial. This person is known as a “shomer’ –“guardian.”
There are several reasons for this enactment. One reason is to ensure that the body does not come to desecration through mice, fire, or robbery. Another reason is to show honour to the deceased by guardian the body and not abandoning it like something unimportant.
Having said that there is room one can be lenient in certain instances, and if you don't find someone to take your place you may leave, since this is called beshat hadchak.
Source
Brachos 18a; Rema YD 373:5; Gesher Hachayim 5:4:4; Chochmas Adam - Kuntrus Matzeves Moshe 14; Igros Moshe YD 1:225; Sisri U’magini 41