Closing UDP socket

The earlier behaviour depended on the logging process dying after logs
or risked leaking ports. This closes the port as part of the logging
procedure.