I am working on Exercise II.3.5 b) in Hartshorne. It asks to show that a finite morphism is closed.
I am working on a way to show that this is true in the affine case, but I am having trouble showing how it generalizes to any scheme.
The following is what I have tried so far:
Let $f:X\rightarrow Y$ be a finite morphism.
Therefore there exists a covering $Y=\cup_{i\in J}\text{Spec}B_i$ such that $f^{-1}(\text{Spec}B_i)$ is affine for all $i$, where $f^{-1}(\text{Spec}(B_i))=\text{Spec}A_i$ and $A_i$ is finitely generated as a $B_i$-module.
Let $D$ be an arbitrary closed subset of $X$. Then $D=\bigcup_{i\in J}(D\cap \text{Spec}A_i)$ such that each $D\cap \text{Spec}A_i$ is closed in $\text{Spec}A_i$.
Therefore since $f$ restricted to $\text{Spec}A_i$ is a finite morphism of affine schemes, we have that $f(D\cap \text{Spec} A_i)$ is closed in $\text{Spec}B_i$.
I am stuck however because $f(D\cap \text{Spec} A_i)$ closed in $\text{Spec}B_i$ does not necessarily imply closure in $Y$, and because even if it did, $Y$ is not necessarily compact, so the union of such sets is not necessarily closed.
I am worried that I am going about this in the wrong way. Does anyone have any hints about a better way to proceed?