Why morphism between curves is finite?

If $X$ is a complete nonsingular curve over $k$, $Y$ is any curve over $k$, $f: X \to Y$ is a morphism not map to a point (so $f(X)=Y$), then $f$ is a finite morphism.

This is the assertion prove in Hartshorne Chapter2, Prop6.8. But the proof is a little sketchy at the point of the inverse image of an affine set is also affine. I quote it here:

...Let $V=\rm{Spec}B$ be any open affine subset of $Y$. Let $A$ be the integral closure of $B$ in $K(X)$. Then $A$ is a finite $B$-module, and Spec$A$ is isomorphic to an open subset $U$ of $X$. Clearly $U=f^{-1}(V)$...

Can anyone explain why "Spec$A$ is isomorphic to an open subset $U$ of $X$. Clearly $U=f^{-1}(V)$"?


Since $X$ is complete, the morphism $f$ is proper.
For any closed point $y\in Y$, the fibre $F=f^{-1}(y) $ is closed and strictly included in $X$ , because $f$ is not constant.
Hence $F$ is finite, i.e. $f$ is quasi-finite.
But a proper and quasi-finite morphism is finite, and so $f$ is indeed a finite morphism.