implemented handling sockets that were closed by client, tnx to @FlorianPalm for some hints
*not tested for windows* :(
closes #145