$B$ consists of the points $(0,\frac{1}{2}), (\frac{1}{2}, \frac{1}{2}), (\frac{2}{3},\frac{1}{2}), (\frac{3}{4}, \frac{1}{2}), \ldots$.
I claim that this set is closed, i.e. equal to its own closure.
Consider the point $(x,y) \notin B$ in the unit square.
If $x \in \pi_1[B]$ (so the first coordinate is one of $0, \frac{1}{2}, \frac{2}{3}, \frac{3}{4},\ldots$, then $y \neq \frac{1}{2}$ and (when $y \in (0,1)$) then we some distance $r>0$ to $\frac{1}{2}$, and we find some open interval $I$ in $[0,1]$ such that $\frac{1}{2} \notin I$, and then $\{x\} \times I$ is lexicographically an open interval this is disjoint from $B$. (When $y=0$ or $y=1$ a minor adaptation is needed, because then the endpoint of the interval lies in another vertical stalk)
If $x \notin \pi_1[B]$ it's easier still: $\{x\} \times [0,1]$ is a neighbourhood of $x$ that misses $B$ as well.