Remove socket when closed.