shouldn't the udpSocket close be outside the delegate check?