Closure of image of diagonal morphism of S-scheme

Let $X$ be an $S$-scheme with structural morphism given by $f : X \to S$. The image of the diagonal morphism $\Delta : X \to X \times_S X$ is contained in the subset $Z := \{ z \in X \times_S X : p(z) = q(z) \} \subset X \times_S X$ where $p, q$ are the projection maps.

Is $Z$ closed in general? Is it furthermore the closure of $\Delta(X)$?

-

In general, $Z$ will not be closed. As an example, consider $X=\mathbb{A}^1_k$, $S=\text{Spec}(k)$, where $k$ is a field. Then we have $X\times_S X=\mathbb{A}^2_k$ is the affine plane over $k$. Let $C$ be an irreducible plane curve which is not a vertical or horizontal line, or the diagonal. The curve $C$ has a generic point $x_C\in X\times_S X$, which is not closed. One can check that $p(x_C)=q(x_C)$ is the generic point of $X$, so $x_C \in Z$. However, the closure of $\{x_C\}$ contains all of the (closed) points lying on the curve $C$, so by hypothesis, contains a point not on the diagonal. This point will not be in $Z$, so $Z$ is not closed.
Is it obvious that $p(x_c)=q(x_c)?$ and is the generic point of $X?$ –  Ehsan M. Kermani Jul 25 '12 at 0:35
@ehsanmo Because $p$ is continuous, $p(\overline{\{x_C\}})\subset \overline{\{p(x_C)\}}$. This means that $p(x_C)$ must be a point of $X$ which contains $p(C)$ in its closure. Because $C$ is irreducible and not contained in a vertical fiber, we must have that $p(C)$ is dense in $X$. It follows that $f(x_C)$ is the generic point of $X$. Likewise for $q$. –  Julian Rosen Jul 25 '12 at 2:08