Hamming distance equals hamming weight under $XOR$ closure

Under the condition of closure under XOR, $S$ is a linear subspace (code) of $\mathbb{F}_2^n$ and thus you are proving that the minimum weight of any non-zero codeword in a linear code equals its minimum distance. I will provide a proof for the sake of completeness and future reference.

Denote by $x \in S$ one of the non-zero words with minimum weight $w(S)$. Then, by assumption of closure under addition $x\oplus x = 0 \in S$ is contained in $S$ and $d(x,0) = w(x)=w(S)$. Hence, the minimum distance is at most $d(S)\leq d(x,0) = w(S)$.

On the other hand, $w(S)\leq d(S)$, since there exist $x,y \in S$, $x\neq y$ with $d(x,y) = d(S)$ and it holds that $d(x,y) = w(x\oplus y)$ and $(x\oplus y)\in S$ by assumption of closure and thus the minimum weight of all words in $S$ is at most $d(S)$.