I'm starting to learn some algebraic topology now, and came across the "classical" version of the Seifert-van Kampen theorem, whose statement is given in Theorem $4.5.2,$ on page $69$ here.
If $X = U_1 \cup U_2$ with $U_1, U_2$ open, and $U_1, U_2, U_1 \cap U_2$ path connected, and if $x_0 \in U_1 \cap U_2$ then $\pi_1(X,x_0) = \pi_1(U_1,x_0)\ *_{\pi_1(U_1 \cap U_2,x_0)} \ \pi_1(U_2,x_0)$, where the amalgamation is defined via the maps induced by inclusions.
(The statement of the theorem in the link said $X = U_1 \cap U_2$, but as Michael correctly pointed out below, this should be $X = U_1 \cup U_2$.)
Does this theorem still hold if $U_1, U_2$ are both closed in $X$ instead$?$ It probably doesn't $($else it would have been mentioned somewhere...$)$, but I don't see a counterexample.