# Finite morphisms of schemes are closed

I want to prove that finite morphisms of schemes are closed, but I cannot prove the affine case, namely:

Given a finite morphism of rings $\varphi :B \to A$ prove that the induced morphism of schemes $f:X \to Y$ is closed.

For this I'm trying to show that $f(V(I))=V(\varphi ^{-1}(I))$, where $V(I)$ denotes the set of all prime ideals that contain $I$.

I managed to prove the above equality only when $I$ is prime (Going-Up theorem), but I am missing something when $I$ is an arbitrary ideal of $A$. Also, from this I can reach the conclusion when $A$ is noetherian, since any closed set would be a finite union of irreducible closed sets, but I cannot figure out the general case.

As the comment said, we need to first reduce to the case $I=0$, because $B \to A \to A/I$ still satisfies going up. And then reduce to the case $\varphi$ is injective since we can replace $B$ by $B/\ker(B \to A)$.
But before using the going-up theorem, we need to show that if $\varphi: B \to A$ is injective, then $\mathrm{Spec}(A) \to \mathrm{Spec}(B)$ hits all the minimal primes of $\mathrm{Spec}(B)$.
If $p$ is a minimal prime of $B$, $B_p$ has a unique prime ideal. Since localization of an exact sequence is exact, $A_p$ has a prime $PA_p$ such that $PA_p \cap B_p=pB_p$.