Closedness in scheme theory Let $X$ be a scheme and $(U_i)_{i\in I}$ an open covering,
(1) Given a subset $Z\subset X$, why does $Z\cap U_i$ is closed for all $i$ implies that $Z$ is closed?
(2) Let $A$ be a ring. Given a morphism schemes  $f:X\rightarrow \operatorname{spec} A$ such that $f_Y:X \times_{\operatorname{spec}A} Y\rightarrow Y$ is closed for all affine $A$ schemes $Y$, does this imply that $f$ is universally closed?
 A: (1) Because then
$$X-Z=\bigcup_i \left(U_i-(U_i\cap Z)\right)$$
and since $U_i\cap Z$ is closed in $U_i$ we see that $U_i-(U_i\cap Z)$ is open in $U_i$ and thus open in $X$.
(2) Yes, by 1). To check that $f$ is universally closed let $Y$ be any $A$-scheme. We need to show that $f(X_Y)$ is closed in $Y$. But, let $Y=\bigcup_i U_i$ for affine open subschemes $U_i$ of $Y$. By 1) it suffices to see that $f(X_Y)\cap U_i$ is closed for all $i$. But, note that $f(X_Y)\cap U_i=f(X_{U_i})$. Indeed, this follows from the Cartesian diagram
$$\begin{matrix} X_{U_i} & \to & X_Y & \to & X\\ \downarrow & & \downarrow & & \downarrow\\ U_i & \to & Y & \to & \mathrm{Spec}(A)\end{matrix}$$
So then, it suffices to show that $f(X_{U_i})$ is closed. But, since $U_i$ is an affine $A$-scheme we know this by assumption.
A: Finite morphisms of schemes are closed.. Look at the answer here for the first part.
Let $Y$ be an $A$-scheme. Say $Y=\bigcup_i Y_i$ where $Y_i \subset Y$ are open affine subschemes. Shall show $f_Y : X\times_A Y\rightarrow Y$ is a closed map. Let $C\subset X\times_A Y$. Set $C_i:= C\cap X\times_A Y_i=(id \times \theta_i)^{-1}(C)$ . Then $C_i$ is closed in $X\times_A Y_i$ which is an open sub-scheme of $X\times_A Y$. We have the commutative diagram
$\require{AMScd}$
\begin{CD}
X\times_A Y_i @>{f_{Y_i}}>> Y_i\\
@V{id \times \theta_i}VV @V{\theta_i}VV\\
X\times_A Y @>{f_Y}>> Y
\end{CD}
$f_Y(C)\cap Y_i=\theta_i^{-1}f_Y(C)=f_{Y_i}(id\times \theta_i)^{-1}C=f_{Y_i}(C_i)$ which is closed in $Y_i$ by assumption. So by the previous part, $f(C)$ is closed in $Y$. Thus $f$ is universally closed.
