Clopen iff union of open connected components

Wikipedia says, that in case all connected components are open, a subset is clopen iff it is a union of connected components.

While the first implication has been shown in this post, I'm trying to prove the opposite direction.

Let $(X,\tau)$ be a topological space with the assumptions from above. Further let $A \subseteq X$ be the union of a family $(U_i)_{i \in I}$ of connected components.

Of course, $A$ is open (arbitrary union of open sets). But why is $A$ closed? I'm thinking proof by contradiction, by showing that for $A \subsetneq \bar A$ one $U_{i_0}$ can't be maximal but I haven't had success so far.

Problem: Take $x \in \bar A \setminus A$ and its respective connected component $U_x$. The assumptions are not violated, if $U_x = \{x\}$. Following this path I get, that $\bar A$ is clopen.

Any hints?

• The complement of $A$ is also a union of connected components... – kccu Jan 8 '16 at 17:36
• @kccu: This does the trick. Thanks! – el_tenedor Jan 8 '16 at 17:39

A set $X$ is a disjoint union $(U_i)_{i\in I}$ where $U_i$ is a connected component, suppose that $Y\subset X, Y=\cup U_{j,j\in J\subset I}$ write $I=J\cup L$, the complement of $Y$ is $Z=\cup_{l\in L}U_l$. $Z$ is open, thus $Y$ is closed.