Ant.GenericChannel.close vs release, how to reconnect to different ANT device?

My datafield connects to either a given ANT ID or to the nearest available ANT device (by using deviceNumber:0). But sometimes it disconnects not to the device I meant, so I "disconnect" but then it doesn't connect to any OTHER device (it can connect to the same device again)

I figured that the problem might be in that I don't really understand what's the difference between close() and release() or what is the way I am supposed to use them.

In the datafield's setting I have a property for the ANT ID. If I change it to something "else" (not the currently connected ID) then I call close(), setDeviceConfig() and open(). This seemed to work, but it looks like it only worked because in my tests I always reconnected to the same device again (by changing the ANT ID to some random number to disconnect, and then to either the actual ID of my test device or to 0) But it is not able to connect to any other ID.

So I tried to change close() to release(), but then it seams to release the channel in a way that it's not able to do anything (calling any other function causes exception). So what I was able to do is to release() then throw away my Sensor object and then create a new one. This works, but it needed some code to be added, and it feels like a hack.

What is the right way to disconnect the GenericChannel in a way that it is "reset" to the same state it would be right after creating a new GenericChannel?

What really is the difference between close() and release()?

class ExtHRMSensor extends Ant.GenericChannel {
    var deviceCfg as DeviceConfig;

    public function initialize() {
        try {
            Ant.GenericChannel.initialize(method(:onMessage), new Ant.ChannelAssignment(
                Ant.CHANNEL_TYPE_RX_NOT_TX, // Bidirectional Receive (Slave)
                Ant.NETWORK_PLUS)
            );
        } catch (e instanceof Ant.UnableToAcquireChannelException) {
            errorRelease("" + e.getErrorMessage());
            searching = -1;
        }
    }

    public function setAntId(antId as Number) as Void {
        if (antId != deviceCfg.deviceNumber) {
            deviceCfg = newDeviceConfig();
            deviceCfg.deviceNumber = antId;
            close();
            // release();
            open();
        }
    }

    hidden function newDeviceConfig() as DeviceConfig {
        // Set the configuration
        return new Ant.DeviceConfig( {
            :deviceNumber => -1 /*antID*/,         // Set to 0 to use wildcard search
            :deviceType => DEVICE_TYPE,            // Heart Rate Sensors: 0x78 = 120
            :transmissionType => 0,                // Set to 0 to use wildcard search
            :messagePeriod => PERIOD,              // 4Hz: 8070, 2Hz: 16140, 1Hz: 32280
            :radioFrequency => 57,                 // ANT+ Frequency 2.457GHz
            :searchTimeoutLowPriority => 10,       // Timeout in 25s
            :searchThreshold => 0} );              // Pair to all transmitting sensors
    }

    public function open() as Boolean {
        GenericChannel.setDeviceConfig(deviceCfg);
        return GenericChannel.open();
    }
}