I am trying to prove that a finite morphism $f: X \longrightarrow Y$ of schemes is a closed map. That is, that the image of a closed set is closed in $Y$. I am a little unsure about the proof that I have, and I am very new to this stuff so am prone to missing subtleties. I would really appreciate if anyone could glance through what I have and see if my argument is valid.
One thing I am a particularly curious about is in the second last paragraph. Do I need to specifically choose the ideal $\mathcal{I}$ to give $Z$ the reduced subscheme structure or not?
The following is my attempt at a proof:
We will first show the following lemma: Let $f: \text{Spec } A \longrightarrow \text{Spec } B$ be a finite morphism of affine schemes corresponding to a morphism $\phi: B \longrightarrow A$ of rings. Then $f(\text{Spec } A)$ is closed in $\text{Spec } B$. To show this, first note that if $f$ is a finite morphism, then $\phi$ is a finite morphism of rings. This implies that $\phi: B \longrightarrow A$ is integral. That is, that $A$ is an integral extension of $\phi(B)$. We have the surjective morphism $$ \pi: B \longrightarrow B / \ker\phi $$ from which we get a morphism of schemes $$ \iota: \text{Spec } (B / \ker \phi) \longrightarrow \text{Spec } B $$ which is a homeomorphism onto a closed subset of $\text{Spec } B$. The morphism $f: \text{Spec } B \longrightarrow \text{Spec } A$ factors as $$ \text{Spec } A \stackrel{\tilde{\phi}^{*}}{\longrightarrow} \text{Spec } (B / \ker \phi) \stackrel{\iota}{\longrightarrow} \text{Spec } B. $$ So to show that $f(\text{Spec } A)$ is closed in $\text{Spec } B$, we need only show that $\tilde{\phi}^{*}$ is surjective. But $\tilde{\phi}^{*}$ is induced by the injective morphism of rings $$ \tilde{\phi}: B / \ker(\phi) \longrightarrow A, $$ which corresponds to an integral extension $B / \ker(\phi) \subseteq A$. Surjectivity then follows by the Going-Up Theorem.
We will now show that $f: \text{Spec } A \longrightarrow \text{Spec } B$ is a closed map. Let $Z \subseteq \text{Spec } A$ be any closed subset of $\text{Spec } A$ corresponding to an ideal $\mathcal{I} \subseteq A$ so that $Z = \text{Spec } (A / \mathcal{I})$. But since $A$ is finite over $B$ via $\phi$, we also have $A / \mathcal{I}$ is finite over $B$. Then by the above result, we have that $f(\text{Spec } (A /\mathcal{I}))$ is closed in $\text{Spec } B$.
Finally, for the general case of a finite morphism $f: X \longrightarrow Y$ of schemes, we use the fact that $Z \subset X$ is closed precisely if it is closed in the induced topology of any affine open in $X$. Similarly, $f(Z)$ is closed in $Y$ precisely if it is closed in the induced topology of any affine in $Y$. The result then follows from the above on affines.