# Sums of topological spaces

Is the following naive characterization of closed sets in sums (=disjoint unions) of topological spaces valid?

Let $(X_i)_{i\in I}$ be family of topological spaces and let $X = \bigsqcup_{i\in I}X_i$ be its sum (disjoint union). We regard each $X_i$ as a subspace of $X$ under the obvious embedding.

Suppose $D\subseteq X$. Is it true that $D$ is closed if and only if $D\cap X_i$ is closed for each $i\in I$?

-

It is the same thing to ask whether a subset $U \subseteq X$ is open if and only if $U \cap X_i$ is open for each $i$ in $I$. (Take complements!) But this is certainly so, by the definition of the disjoint union topology.