The Messenger of Allah ﷺ said, "When you are present at the death of one of your own, close his eyes, for the sight follows the soul. And speak only good, for the angels say amen to whatever the family of the deceased says."
حدثنا حسن بن موسى قال حدثنا قزعة قال حدثني حميد الأعرج عن الزهري عن محمود بن لبيد
قال رسول الله ﷺ إذا حضرتم موتاكم فأغمضوا البصر فإن البصر يتبع الروح وقولوا خيرا فإنه يؤمن على ما قال أهل الميت
Its isnad is hasan. The hadith was narrated by Ibn Majah 1/467, no. 1455, and he said in Zawaid, "Its isnad is hasan because Suwayd bin Qays is disputed regarding his reliability, while the rest of its narrators are trustworthy."