Great news for all photographers shooting 360x180° panoramas! As of now, it couldn't be easier to patch the zenith and nadir while staying at a high bit depth using software that cares about your freedom. No more buying Adobe Photoshop plugins (eek!), no more fiddling with Hugin (it is a powerful program mind you), no more resorting to command-line utilities. Do it with GIMP and G'MIC, DO IT NAO!
1. Open your equirectangular panorama
Open your equirectangular panorama in GIMP-2.9.anything (I pity the fool that still uses 2.8).
It must be in the equirectangular projection and the canvas must stretch to the full 360x180° dimensions - this is pretty much standard behavior of any decent panorama stitching program. You can easily check that it is so by making sure that the width:height are at a 2:1 ratio.
2. Extract the zenith and nadir
You need to get the latest filters, so click on the "Update filters" button.
Click "Deformations > Equirectangular to nadir-zenith", and set the "Mode" to "to nadir/zenith". You can see in the preview that your nadir and zenith are ready to be extracted. Just one more thing.
Since you will need to re-project the nadir and zenith back into the panorama when they're fixed, you will want to hold on to the original panorama layer, so set "Output mode..." to "New layer(s)"
3. Patch the zenith and nadir
Some like to smack a logo on the nadir, some like to cover the hole with a fisheye projection of the whole pano which looks like a mirror ball. Me, I just like to fix it and leave it looking natural. The various ways of fixing the hole (cloning, healing, in-painting, merging a separately taken photo of the floor and ceiling/sky to cover the holes) are general retouching knowledge and not within the scope of this guide.
4. Inject the zenith and nadir
Back to G'MIC, click "Deformations > Equirectangular to nadir-zenith", and set the "Mode" to "to equirectangular".
To save RAM (huge 32-bit panoramas live on grass and RAM) set "Output mode..." to "In place (default)".
That leaves you with this:
Make both layers visible, and "Flatten Image":
Done. Couldn't be easier.
Thank you @David_Tschumperle for G'MIC and for porting the script! And of course thank you to the developers of GIMP and countless other open-source programs involved in the whole workflow and to the generations of their ancestors making the right choices and not eating the wrong mushrooms which all lead to their birth :]