also fire close event when any error occur during connecting