Added error handling for gen_udp:open