Fixed error when socket close.