SERVER-12745: Fix shutdown race in closing sockets