hmmm. This is surely very difficult to deal with, and I feel it is pretty much impossible to give any good advice on this without knowing your friend a little better. I'd think it really depends on how he is looking at the situation, and how his health affects/limits his options of making music.
From my work experience with people who are about to go, I can say this much:
I have seen many people take a lot longer to finally die than anyone would have predicted, and I have witnessed weird moments where people had come by for the last farewell, and then the old person continued to live for some more years.
This may not be likely with your friend, what I'm trying to say is:
You might want to avoid marking any get together as THE FINAL one, so you keep the door open for maybe one more.
You should be aware it always may have been the final one, but to attempt to nail it yourself... I'm not sure, but maybe your friend also wants to have it "done with"?
Maybe try to switch views and take the position of "music making never really stops - one can tap a drumsolo on ones last blanket, too, why end that source of strength?
I know, the last recording is something else, but will the last recording really make anyone happy? Imagine listening to your last recording and feeling you messed up in some part... now how bad is that?
Maybe you should try to find out what exactly your friend would like to record, and whether it might not also be a good idea to have him record some spoken words if he'd like to "leave something".
Trying to express that in music in an improvisation scenario ... I don't know, I would not want to try and fail with that (and I'm rarely 1000% happy with a recording).
Wishing you and your friend good inspirations on how to deal with the difficult situation.
Just don't "waste" the precious moment aiming to record anything and potentially getting frustrated about it.
You are there, in that situation, together, and instead of crying or complaining, you are making music.
That's greater than any recording will ever be I'd say.
Hope this is OK, not intending to hurt any feelings here.
p.s.
I edited out the f-word from your initial post, please do not use language like that on wikiloops, we have kids around here ;)