I have a question regarding a proof from Bosch's Algebraic Geometry book, namely section 9.5, Proposition 3, part (ii):
Let $f:X\rightarrow Y=\text{Spec}(B)$ be a morphism of schemes. $f$ is quasi-affine if and only if $X$ is quasi-affine.
My question is about the proof of the if - part, i.e. assuming $f$ is quasi-affine. The argument is as follows. Write $A = \mathcal{O}_X(X)$ and look at the canonical decomposition $$f: X\rightarrow \text{Spec}(A)\rightarrow Y = \text{Spec}(B).$$ For $g\in B$ consider the open set $D(g) = \text{Spec}(B_g)$ and its preiamge in $\text{Spec}(A)$, namely $\text{Spec}(A\otimes_B B_g)$. Denote by $X_g$ the preiamge $f^{-1}(D(g))$ in $X$ and write $f_g = f|_{X_g}$. Then $f_g$ decomposes into $X_g\rightarrow \text{Spec}(A\otimes_B B_g)\rightarrow \text{Spec}(B_g)$. Then the author takes a finite affine cover $(U_i)_{i\in I}$ of $X$. Since $f$ is separated, all intersections $U_i\cap U_j$ are affine and he consideres the exact sequence $$ A = \mathcal{O}_X(X)\rightarrow \prod_{i\in I}\mathcal{O}_X(U_i)\rightrightarrows \prod_{i,j\in I} \mathcal{O}_X(U_i\cap U_j).$$
Tensoring by $B_g$ over $B$ preserves exactness of the sequence. So far so good, no questions up until now: He then claims: ''This shows that the morphism $A\otimes_B B_g\rightarrow \mathcal{O}_X(X_g)$ is an isomorphism''
Why is that? I have seen this argument a few times now in different proofs and was never able to make any sense of it. Any comment is highly appreciated! :)
Bosch's definition of a quasi-affine scheme and quasi-affine morphism (from the comments):
A scheme $X$ is quasi-affine if it is quasi-compact and there is an open immersion $X\to\operatorname{Spec} R$ into some affine scheme.
A morphism $f:X\to Y$ is quasi-affine if there exists a quasi-affine covering $\{V_i\}_{i\in I}$ of $Y$ so that $f^{-1}(V_i)$ is quasi-affine for all $i\in I$.