Add more logs and clean references when web socket closed.