commands: fix race when open()/close() cmd socket
commands: fix race when open()/close() cmd socket

When we report STOPPED to a caller and then close the command socket it is
technically possible - and I've seen this happen on the test builders - that a
container start() right after a wait() will receive ECONNREFUSED because it
called open() before we close(). So for all new state clients simply close the
command socket. This will inform all state clients that the container is
STOPPED and also prevents a race between a open()/close() on the command socket
causing a new process to get ECONNREFUSED because we haven't yet closed the
command socket.

Signed-off-by: Christian Brauner <48455ab3070520a2d174545c7239d6d0fabd9a83@ubuntu.com>

thmo/lxc,ss1h2a3tw/lxc,caglar10ur/lxc,thmo/lxc,hallyn/lxc,ss1h2a3tw/lxc,thmo/lxc,hallyn/lxc,caglar10ur/lxc,caglar10ur/lxc,ss1h2a3tw/lxc,hallyn/lxc