Scan wifi networks after wrong SSID/Password on RCM5600w


I have made an UI in c# that communicates via serial port with a rabbit RCM5650w module.
I can connect correctly with WEP/WPA/WPA2 using the correct SSID and password and also I can perform a scan of the available networks. I use ifconfig function.

The problems arises when I set a wrong password.

Clealry, ifup isn’t performed so I come up of the TCP_TICK while loop with a timer. But, after this I can’t perform another scan of the wifi networks.
I have to restart the rabbit to connect to another network…

Why is that?
If there a way to know if the proper password was set in order to not set the interface up?

The same happens using a wrong SSID but the SSID isn’t modifiable by the user.