Closed points of a scheme correspond to maximal ideals in the affines? 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.
 A: 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
A: If $X=\mathrm{Spec}(A)$ is the spectrum of a discrete valuation ring, then the generic point $\eta$ is an affine open, namely $\mathrm{Spec}(k(\eta))$. Of course $\{\eta\}$ is closed in itself, but not in $\mathrm{Spec}(A)$. So this shows that a closed point in an affine open need not be closed in the ambient scheme.
This does, however, hold for schemes locally of finite type over a field $k$. Namely, if $X$ is such a $k$-scheme and $x\in X$ is closed in some affine open $\mathrm{Spec}(A)$, then $k(x)=A/\mathfrak{p}_x$ is an extension field of $k$ which is of finite type over $k$. So it is finite over $k$ by Zariski's lemma (also known sometimes as the Nullstellensatz). Now if $U=\mathrm{Spec}(B)$ is any affine open containing $x$, then $x$ corresponds to a prime $\mathfrak{p}_x^\prime$ of $B$, and $B/\mathfrak{p}_x^\prime$ is contained in $k(x)$ ($k(x)$ is the fraction field of this domain in fact). Since $k(x)/k$ is finite, we see that $B/\mathfrak{p}_x^\prime$ is a domain finite over a field, and so is itself a field, i.e., $\mathfrak{p}_x^\prime$ is a closed point of $\mathrm{Spec}(B)$. Since the affine opens cover $X$, it follows that $x$ is a closed point of $X$.
Perhaps there are other situations where closed points of affine opens are closed. I learned this particular fact from Qing Liu's book on algebraic geometry. If we're lucky maybe he will see this problem and add some further insight :)
