I'm very sorry for your loss, know that you're doing the right thing and just stay there to see it's end. He trusts you so you being there should make him less scared of what's inevitably coming and he kinda knows what's going on at this point, animals know those things.
It's just better that he doesn't go alone - There's nothing you could do differently that would change the fact that he's dying, apart from being there.
In
Now let me go catch a breather, because as someone said that's a instant lump in throat story for anyone with pets. We outlive them, that's a fact... And time and time again we're reminded of that. It sucks.
Probably doesn't make you feel any better but you should be glad you're able to say goodbye, lots of pets die crossing the road, poisoned, lost and scared or simply don't appear ever again, and in lots of ways that's no closure, they were there for your worse moments and you kinda feel you weren't there for them. You're there for him, that's a good thing even if it doesn't feel like it at all.
Also, life as an organism has a funny way to work... You know? I mean that, he possibly only held up as long as he did because you were away from home all this time, Elephants hold out until reaching their dying spot and even with human life expectancy, people with sons and daughters live longer, we hold out for an end. I'm sure it hurts right now, but I'm sure he was waiting for you everyday.
Holy shit I'm proper crying.