Workaround a Firefox bug and restart closed sockets immediately