fix: should set 0 to connection flag when connection has been closed.