Don't try to open or close sockets twice