According to Vakil, a scheme morphism $\pi: X \to Y$ is finite if for every affine open subset $\operatorname{Spec} B$ of $Y$, $\pi^{-1}(\operatorname{Spec} B) = \operatorname{Spec} A$ with $A$ a finite $B$-algebra. Then the reader is asked to prove that if $Y$ admits an open cover $\{\operatorname{Spec} B_i\}$ such that $\pi^{-1}(\operatorname{Spec} B_i)$ is the spectrum of a finite $B_i$-algebra, then $\pi$ is finite (c.f. Exercise 7.3.G).
My guess is to apply the Affine Communication Lemma 5.3.2 (similar to Exercise 7.3.C), so I have to show that
(i) If $\operatorname{Spec} B \subseteq Y$ such that $\pi^{-1}(\operatorname{Spec} B)$ is the spectrum of a finite $B$-algebra, then $\pi^{-1}(\operatorname{Spec} B[g^{-1}])$ is the spectrum of a finite $B[g^{-1}]$-algebra.
(ii) If $\operatorname{Spec} B \subseteq Y$ and $(g_1, \cdots, g_n) = B$ such that $\pi^{-1}(\operatorname{Spec} B[g_i^{-1}])$ is the spectrum of a finite $B[g_i^{-1}]$-algebra, then $\pi^{-1}(\operatorname{Spec} B)$ is the spectrum of a finite $B$-algebra.
Well, (i) is easy, but I don’t see a way to prove (ii). Since $\operatorname{Spec} B$ is covered by the distinguished open subset $D_B(g_i)$, it follows that the restriction of $\pi$ to a morphism $\pi^{-1}(\operatorname{Spec} B) \to \operatorname{Spec} B$ is affine (by Proposition 7.3.4), so $\pi^{-1}(\operatorname{Spec} B)$ is the spectrum of a ring $A$. Since $\operatorname{Spec} A \to \operatorname{Spec} B$ corresponds to a ring morphism $B \to A$, this gives $A$ the structure of a $B$-algebra. But how can I show that it is a finitely generated $B$-module? I know I didn’t used all the hypothesis, But I honestly don’t see a way to put them together to get the desired conclusion.
Any help is appreciated.