Choose a compactification $U_i \subset X_i$ for $i = 1, 2$. We may assume $U_i$ is scheme theoretically dense in $X_i$. We may assume there is an open $V_i \subset X_i$ and a proper morphism $\psi_i : V_i \to U$ extending $\text{id} : U_i \to U_i$, see Lemma \ref{lemma-compactification-dominates}. Picture $$ \xymatrix{ U_i \ar[r] \ar[d] & V_i \ar[r] \ar[dl]^{\psi_i} & X_i \\ U } $$ If $\{i, j\} = \{1, 2\}$ denote $Z_i = U \setminus U_j = U_i \setminus (U_1 \cap U_2)$ and $Z_j = U \setminus U_i = U_j \setminus (U_1 \cap U_2)$. Thus we have $$ U = U_1 \amalg Z_2 = Z_1 \amalg U_2 = Z_1 \amalg (U_1 \cap U_2) \amalg Z_2 $$ Denote $Z_{i, i} \subset V_i$ the inverse image of $Z_i$ under $\psi_i$. Observe that $\psi_i$ is an isomorphism over an open neighbourhood of $Z_i$. Denote $Z_{i, j} \subset V_i$ the inverse image of $Z_j$ under $\psi_i$. Observe that $\psi_i : Z_{i, j} \to Z_j$ is a proper morphism. Since $Z_i$ and $Z_j$ are disjoint closed subsets of $U$, we see that $Z_{i, i}$ and $Z_{i, j}$ are disjoint closed subsets of $V_i$. \medskip\noindent Denote $\overline{Z}_{i, i}$ and $\overline{Z}_{i, j}$ the closures of $Z_{i, i}$ and $Z_{i, j}$ in $X_i$. After replacing $X_i$ by a $V_i$-admissible blowup we may assume that $\overline{Z}_{i, i}$ and $\overline{Z}_{i, j}$ are disjoint, see Lemma \ref{lemma-separate-disjoint-locally-closed-by-blowing-up}. We assume this holds for both $X_1$ and $X_2$. Observe that this property is preserved if we replace $X_i$ by a further $V_i$-admissible blowup. \medskip\noindent Set $V_{12} = V_1 \times_U V_2$. We have an immersion $V_{12} \to X_1 \times_S X_2$ which is the composition of the closed immersion $V_{12} = V_1 \times_U V_2 \to V_1 \times_S V_2$ (Schemes, Lemma \ref{schemes-lemma-fibre-product-after-map}) and the open immersion $V_1 \times_S V_2 \to X_1 \times_S X_2$. Let $X_{12} \subset X_1 \times_S X_2$ be the scheme theoretic image of $V_{12} \to X_1 \times_S X_2$. The projection morphisms $$ p_1 : X_{12} \to X_1 \quad\text{and}\quad p_2 : X_{12} \to X_2 $$ are proper as $X_1$ and $X_2$ are proper over $S$. If we replace $X_1$ by a $V_1$-admissible blowing up, then $X_{12}$ is replaced by the strict transform with respect to this blowing up, see Lemma \ref{lemma-replaced-by-strict-transform}. \medskip\noindent Denote $\psi : V_{12} \to U$ the compositions $\psi = \psi_1 \circ p_1|_{V_{12}} = \psi_2 \circ p_2|_{V_{12}}$. Consider the closed subscheme $$ Z_{12, 2} = (p_1|_{V_{12}})^{-1}(Z_{1, 2}) = (p_2|_{V_{12}})^{-1}(Z_{2, 2}) = \psi^{-1}(Z_2) \subset V_{12} $$ The morphism $p_1|_{V_{12}} : V_{12} \to V_1$ is an isomorphism over an open neighbourhood of $Z_{1, 2}$ because $\psi_2 : V_2 \to U$ is an isomorphism over an open neighbourhood of $Z_2$ and $V_{12} = V_1 \times_U V_2$. By Lemma \ref{lemma-blowup-iso-along} there exists a $V_1$-admissible blowing up $X_1' \to X_1$ such that the strict tranform $p'_1 : X'_{12} \to X'_1$ of $p_1$ is an isomorphism over an open neighbourhood of the closure of $Z_{1, 2}$ in $X'_1$. After replacing $X_1$ by $X'_1$ and $X_{12}$ by $X'_{12}$ we may assume that $p_1$ is an isomorphism over an open neighbourhood of $\overline{Z}_{1, 2}$. \medskip\noindent The reduction of the previous paragraph tells us that $$ X_{12} \cap (\overline{Z}_{1, 2} \times_S \overline{Z}_{2, 1}) = \emptyset $$ where the intersection taken in $X_1 \times_S X_2$. Namely, the inverse image $p_1^{-1}(\overline{Z}_{1, 2})$ in $X_{12}$ maps isomorphically to $\overline{Z}_{1, 2}$. In particular, we see that $Z_{12, 2}$ is dense in $p_1^{-1}(\overline{Z}_{1, 2})$. Thus $p_2$ maps $p_1^{-1}(\overline{Z}_{1, 2})$ into $\overline{Z}_{2, 2}$. Since $\overline{Z}_{2, 2} \cap \overline{Z}_{2, 1} = \emptyset$ we conclude. \medskip\noindent Consider the schemes $$ W_i = U \coprod\nolimits_{U_i} (X_i \setminus \overline{Z}_{i, j}), \quad i = 1, 2 $$ obtained by glueing. Let us apply Lemma \ref{lemma-check-separated} to see that $W_i \to S$ is separated. First, $U \to S$ and $X_i \to S$ are separated. The immersion $U_i \to U \times_S (X_i \setminus \overline{Z}_{i, j})$ is closed because any specialization $u_i \leadsto u$ with $u_i \in U_i$ and $u \in U \setminus U_i$ can be lifted uniquely to a specialization $u_i \leadsto v_i$ in $V_i$ along the proper morphism $\psi_i : V_i \to U$ and then $v_i$ must be in $Z_{i, j}$. Thus the image of the immersion is closed, whence the immersion is a closed immersion. \medskip\noindent On the other hand, for any valuation ring $A$ over $S$ with fraction field $K$ and any morphism $\gamma : \Spec(K) \to (U_1 \cap U_2)$ over $S$, there is an $i$ and an extension of $\gamma$ to a morphism $h_i : \Spec(A) \to W_i$. Namely, for both $i = 1, 2$ there is a morphism $g_i : \Spec(A) \to X_i$ extending $\gamma$ by the valuative criterion of properness for $X_i$ over $S$, see Morphisms, Lemma \ref{morphisms-lemma-characterize-proper}. Thus we only are in trouble if $g_i(\mathfrak m_A) \in \overline{Z}_{i, j}$ for $i = 1, 2$. This is impossible by the emptyness of the intersection of $X_{12}$ and $\overline{Z}_{1, 2} \times_S \overline{Z}_{2, 1}$ we proved above. \medskip\noindent Consider a diagram $$ \xymatrix{ W_1' \ar[d] \ar[r] & W & W_2' \ar[l] \ar[d] \\ W_1 & U \ar[l] \ar[lu] \ar[u] \ar[ru] \ar[r] & W_2 } $$ as in Lemma \ref{lemma-find-common-blowups}. By the previous paragraph for every solid diagram $$ \xymatrix{ \Spec(K) \ar[r]_\gamma  \ar[d] & W \ar[d] \\ \Spec(A) \ar@{..>}[ru] \ar[r] & S } $$ where $\Im(\gamma) \subset U_1 \cap U_2$ there is an $i$ and an extension $h_i : \Spec(A) \to W_i$ of $\gamma$. Using the valuative criterion of properness for $W'_i \to W_i$, we can then lift $h_i$ to $h'_i : \Spec(A) \to W'_i$. Hence the dotted arrow in the diagram exists. Since $W$ is separated over $S$, we see that the arrow is unique as well. This implies that $W \to S$ is universally closed by Morphisms, Lemma \ref{morphisms-lemma-refined-valuative-criterion-universally-closed}. As $W \to S$ is already of finite type and separated, we win.