Here is another example that it wont work: consider a local ring $(R,\mathfrak{m})$ and let $U=\mathrm{Spec}\:R-\{\mathfrak{m}\}$ be its punctured spectrum. Assume that $\mathrm{depth}\:R\geq2$ and $\mathrm{Pic}(U)\neq0$. Now $U\hookrightarrow\mathrm{Spec}\:\Gamma(\mathcal{O}_U)$ is locally an isomorphism (the depth condition implies $\Gamma(\mathcal{O}_U)=R$). Now take a nontrivial line bundle $\mathcal{L}$ on $U$. To say that $\Gamma(\mathcal{L})$ is a projective $\Gamma(\mathcal{O}_U)$-module means $\Gamma(\mathcal{L})$ is a free $R$-module (over local rings projective = free). But this is not true because we assumed $\mathcal{L}$ to be a nontrivial line bundle.