fixed c++ wrapper bug causing the ready state to not be "closed" after a connection error