Fixed UNIX socket close race with cancelled I/O (#1269)