TITLE: Closed points of a scheme correspond to maximal ideals in the affines?
QUESTION [19 upvotes]: Let $X$ be a scheme. If $x\in X$ is a closed point, then it corresponds to a maximal ideal in $\mathcal{O}_X(U)$ for some affine open subset $U\subseteq X$.
If I take an arbitrary open affine $\mbox{Spec}~A$ in $X$ and a maximal ideal $x$ in $A$, then $\{x\}$ is closed in $\mbox{Spec}~A$, but may not be closed in $X$. It might even be the case that $\overline{\{x\}}$ contains a point belonging to an affine that has empty intersection with $\mbox{Spec}~A$.
Or not? Maybe I'm missing some easy topological property here.
Is there an example for such a situation? Or is it actually the case that $\{x\}$ will also be closed in $X$? If not, under what hypotheses on $X$ are all maximal ideals in the rings of affine opens also closed points in $X$?
Thank you in advance.

REPLY [7 votes]: A counter-example(the same as the Keenan Kidwell's)
Let $A$ be a discrete valuation ring.
Let $m$ be its unique maximal ideal.
Let $f$ be a generator of $m$.
Then $A_f$ is the field of fractions of $A$.
Hence $x = {0}$ is a closed point of $D(f) = Spec(A_f)$.
But it is not closed in $Spec(A)$.
Proposition
Let $A$ be a Jacobson ring.
Let $X$ be a scheme of locally finite type over $A$.
Let $x$ be a closed point of an open subset $U$ of $X$.
Then $x$ is a closed point of $X$.
Proof:
Let $\bar {\{x\}}$ be the closure of $\{x\}$ in $X$.
Let $y \in \bar {\{x\}}$.
It suffices to prove that $x = y$.
Let $V = Spec(B)$ be an affine open neighborhood of $y$.
Then $x \in V \cap U$.
There exists an affine open subset $D(f) = Spec(B_f)$ such that $x \in D(f) \subset V \cap U$, where $f \in B$.
Since $x$ is closed in $U$, $x$ is closed in $D(f)$.
Hence $x$ is a maximal ideal of $B_f$.
Since $B_f$ is finitely generated over $A$ and $A$ is a Jacobson ring, $x$ is a maximal ideal of $B$.
Hence $x$ is closed in $V$.
Hence $\bar {\{x\}}\cap V = \{x\}$.
Hence $x = y$ as desired.
QED