Just for others, if you use UDP.stop() it seems to work and I don't seem to need a delay after the endPacket() method before the stop(). Now I can create embryonic UDP instances and close them properly.
I think the UDP documentation and samples should be updated to mention UDP.stop().