fix bug: socket exception when closing tab