A set is closed if and only if it contains its boundary, and open if and only if it is disjoint from its boundary. The boundary of a set is closed; this follows from the formula \partial_X S ~:=~ \overline{S} \cap \overline{(X \setminus S)}, which expresses \partial_X S as the intersection of two closed subsets of X.
