Hard question. I think you have two.
One is about seeing him near death. I don’t think that is mandatory. But if the teen/tween wish to, prepare them.
The other is about going to the funeral. Absent other factors, final exams, for instance, the older two, for sure. The youngest would probably not want to be left out.
But give them choices: such as not viewing an open casket. And let them know what is expected…do they want to speak? Do they want to write something for someone else to read? Do they have stuff to wear?
I did not get to go to any grandparent’s funeral…and I resented being basically prevented from doing so when I was actually an adult…not your question, but may be worth a brief ponder at this difficult time.