socket: fix `onclose` reason