Special case of Grothedieck's Freeness Lemma (Vakil 7.4. F) I've been doing section 7.4 of Vakil's notes on Algebraic Geometry and there is a series of exercises to prove Grothendieck's Generic Freeness Lemma. The first exercise, special case of the lemma, is to prove the following:

Let $B$ be a Noetherian integral domain and $M$ a finitely generated $B$ module. Then there exist a nonzero $f\in B$ such that $M_f$ is a free $B_f$-module.

Proofs of the above that I've seen (e.g in Matsumura, I think) make use of existence of a filtration
$0=M_0\subset M_1\subset \ldots \subset M_n=M$ with $M_{i+1}/M_i\cong B/\mathfrak{p_i}$,
with $\mathfrak{p}\subset B$ a prime ideal. I think there is an easier approach (i.e. not requiring above statement) to prove this particular case:

Take $x_1,x_2,\ldots ,x_n$ to be generators of $M$ as a $B$-module. Let $\mathfrak{a}_i=\text{Ann}(x_i)$. Then $\mathfrak{a}_i\subset B$ is an ideal of Noetherian ring $B$, thus is finitely generated. We reorder $i$'s so that $\mathfrak{a}_i\neq (0)$ for all $1\leq i\leq r$ and $\mathfrak{a}_i=(0)$ for all $i>r$ (with $0\leq r \leq n$). If $r=0$, then $M\cong B^n$ and is free. Otherwise, we have $\mathfrak{a}_i=(f_{i1},\ldots , f_{in_i})$ for all $1\leq i\leq r$. Take $f=\prod f_{ij}$ of all generators for all nontrivial $\mathfrak{a_i}$'s. Then $f\neq 0$ and $M_f\cong B_f^{n-r}$ via homomorphism
$\phi: a_1x_1+\ldots + a_nx_n\mapsto (a_{r+1},a_{r+2},\ldots , a_{n})$
which obviously is onto. For all $1\leq i\leq r$ we have $x_i\sim 0$ in $M_f$, since $fx_i=0$ in $M$. Therefore $\phi$ is injective as well, so it is an isomorphism.

Is this proof correct or is there a mistake in it, which gives the reason for thinking about that special case necessarily in terms of the Matsumura's approach?
 A: As stated in the comments, your prove becomes false at the point, where you claim that the $x_i$ form a basis, if all of them are torsion free. Just take a non-principal ideal in a Dedekind domain. The two generators are both torsion-free, but they dont form a basis.
Actually the prove in this special case is much easier, you just do the natural thing. Get a basis over the fraction field and add the denominators needed. Concretely, you do the following:
Let $S = B - \{0\}$ and $K = S^{-1}B$ the fraction field of $B$. The $x_1, \dotsc, x_n$ generate $S^{-1}M$ as a $K$-vector space, i.e. we can extract a basis, say $x_1, \dotsc, x_m$ with $m \leq n$.
Now write each of $x_{m+1}, \dotsc, x_n$ as $K$-linear combinations of this basis. Let $f$ be the product of all denominators occuring. Then these are actually $B_f$-linear combinations, i.e. $x_1, \dotsc, x_m$ generate $M_f$ as a $B_f$-module.
$x_1, \dotsc, x_m$ are clearly $B_f$-linear independent, since they are $K$-linear independent. Thus $M_f$ is $B_f$-free.
