ensure udp data is sent before closing the udp socket