Closed immersion of separated scheme is separated I'm working on exercise II.4.4 in Hartshorne. I'm stuck on a step and would appreciate some help. Here is the situation I have. $ S $ is a Noetherian scheme. $Y$ is a separated $ S $-scheme of finite type. $W$ is a closed subscheme of $Y$. I want to show that $W$ is separated over $ S $.
I was able to construct the following commutative diagram. The $ \Delta $s are the diagonals.$$\require{AMScd}\begin{CD}W@>>>Y\\ @V{\Delta}VV@V{\Delta}VV\\ W\times_SW@>>>Y\times_SY\end{CD}$$
The diagram commutes because both paths are the unique factorization of $Z\rightarrow Y$ through $Y\times_SY$. If I show that the diagram is cartisian, I can use the fact that closed immersions are preserved under base change.

How can I show that this diagram is cartesian?

In the exercise, $W$ is actually the scheme theoretic image of a morphism $Z\rightarrow X\rightarrow Y$ where $ X $ is also a separated $ S $-scheme of finite type, $ Z\rightarrow X $ is a closed immersion, and $ Z $ is proper over $ S $. I'm not sure if these details are needed for this particular step. After skimming some notes online, it doesn't seem to be the case.

We can show this by showing $W$ has the universal property of the fibre product. The key fact we use about the map $\iota: W\rightarrow Y$ is that it is a monomorphism, e.g. that the map ${\rm Hom}(X,W)\rightarrow {\rm Hom}(X,Y)$ is injective for all schemes $X$. 
Now, suppose $X$ is a scheme such that 
$$\require{AMScd}\begin{CD}X@>>>Y\\ @V{}VV@V{\Delta}VV\\ W\times_SW@>>>Y\times_SY\end{CD}$$
commutes. 
The map $X\rightarrow W\times_S W$ is the same as a pair of maps $\phi_1,\phi_2:X\rightarrow W$ that agree after mapping to $S$. We also have a map $\phi:X\rightarrow Y$. The commutativity of the diagram is the same as saying $\iota\circ \phi_1=\phi=\iota\circ \phi_2$. Since $\iota:W\rightarrow Y$ is a monomorphism, this is exactly saying $\phi_1=\phi_2$. 
Therefore, commutative diagrams above are in bijection with maps $X\rightarrow W$, which is what we wanted. Also, we only used the fact that $\iota$ is a monomorphism, and not that it is a closed immersion (or even that we were working with schemes instead of some other category). 
