do not crash on closed socket