The Gluing of Schemes Along Closed Subschemes Preserves Universal Closedness This is Vakil 16.4 O a), self-study.
We are to show that if $X_1$ and $X_2$ are universally closed $S$-schemes (meaning their structure maps are closed maps topologically and any base change map is closed topologically), that their gluing along closed subschemes $Z_1$ and $Z_2$ is also universally closed.
The gluing along closed subschemes has underlying topological space the topological gluing of the underlying topological spaces of the individual schemes. Its stalks are the usual stalks outside the gluing locus. Let $Z$ be in the image of either closed subscheme in the gluing. Then if $p \in X_1 \cap X_2$, the stalk at $p$ in the gluing is given by those members of $\mathcal O_{X_1, p} \times \mathcal O_{X_2, p}$ which agree in $\mathcal O_{Z_1, p} \simeq \mathcal O_{Z_2, p}$.
I can show that that structure map for the gluing is closed, but showing that base change preserves this closedness eludes me. Vakil says that in fact not only is this gluing a fibered coproduct, which is evident from the construction, but that it also is a fibered diagram. In particular, it commutes with base change. I am unable to show this is true. If pullback in the category of schemes had a right adjoint that we knew about, then I could prove the result since I know then that base change would commute with colimits, of which this gluing is an example. However, I do not believe we have seen that there is such a right adjoint.
Questions: is there such a right-adjoint to pullback in $Sch$? If not, what is the best way to show that gluing commutes with base change?
 A: This can be shown directly without too much trouble. Consider the following diagram, where each of the three rectangles is a pullback square:
$$\require{AMScd}
\begin{CD}
(X_1\coprod X_2)' @>>> X_1 \coprod X_2\\
@VVV @VVV \\
(X_1\coprod_Z X_2)' @>>> X_1\coprod_Z X_2 \\
@VVV @VVV \\
S' @>>> S
\end{CD}$$
where we write $A'=S'\times_S A$ for an $S$-scheme $A\to S$. Since $X_1\coprod X_2\to S$ is universally closed, $(X_1\coprod X_2)'\to S'$ is universally closed as well. As $X_1\coprod X_2\to X_1\coprod_Z X_2$ is surjective and surjectivity is stable under base change, we have that $(X_1\coprod X_2)'\to (X_1\coprod_Z X_2)'$ is surjective. So every closed subset $Y$ of $(X_1\coprod_Z X_2)'$ is the surjective image of a closed subset $\widehat{Y}$ in $(X_1\coprod X_2)'$. Thus the images of $Y$ and $\widehat{Y}$ in $S'$ are the same and therefore closed, as $(X_1\coprod X_2)'\to S'$ is universally closed. Hence $(X_1\coprod_Z X_2)'\to S'$ is closed for any $S'\to S$, and $X_1\coprod_Z X_2\to S$ is universally closed.

As Daniel Hast remarks in the comments, a right adjoint for base change is in general not representable. This can fail even in cases which are not "so bad" - see MO for an example.
