How does one detect that a socket is being closed with Stdio.Buffer?