Implemented socket close event.