Always stay with your dog as they make their final journey. Not just to avoid this sort of thing but your animal will pass feeling much more secure.
My thoughts exactly. Share that final moment with them to ease their suffering. Then things like this could not happen.