Removed state redundant state variable, added catch for socket close event