Clean up UDP code more and migrate creds files.

Untested, but this should work better. Be careful about leaking file descriptors; this is what dynamic-wind is for.
The race condition should be handled in the code that creates the credentials file.