Added disconnect message sending before closing socket