In my course (that vaguely follows Liu's *Algebraic Geometry*) the definition of closed (resp. open) immersion $f:Y\to X$, is that $f$ induces a homeomorphism onto $f(Y)$, $f(Y)$ is closed (resp. open) in $X$, and ($*$) $i^\#_y:\mathcal O_{X,i(y)}\to\mathcal O_{Y,y}$ is surjective (resp. bijective).

But I read that on Gortz & Wedhorn's *Algebraic Geometry I* closed and open immersions are defined differently (the only hypothesis changing is ($*$), the others, the topological ones, are as above). So for an open immersion ($*$) is substituted by this one: $\mathcal O_X|_{f(Y)}$ is isomorphic to $f_*(\mathcal O_Y)|_{f(Y)}$. Now, this is equivalent to $\mathcal O_{X,f(y)}\to f_*(\mathcal O_Y)_{f(y)}$ being an isomorphism for every $y\in Y$; plus the induced $f_*(\mathcal O_Y)_{f(y)}\to \mathcal O_{Y,y}$ is an isomorphism because $f$ is a homeomorphism onto its image, so I see that our condition is actually equivalent to ($*$).

In the definition of closed immersion instead, ($*$) is replaced by $\mathcal O_{X}(U)\to f_*(\mathcal O_Y)(U)$ being surjective for every open $U\subseteq X$. Since $f$ is a homeomorphism onto the image, $f_*(\mathcal O_Y)_{f(y)}\to \mathcal O_{Y,y}$ is again an isomorphism and ($*$) is equivalent to $\mathcal O_{X,f(y)}\to f_*(\mathcal O_Y)_{f(y)}$ being surjective for every $y\in Y$. But if $x\in X\setminus f(Y)$, there is surely an open neighborhood $V\ni x$ such that $V\subseteq X\setminus f(Y)$, using that $f(Y)$ is closed; so $f_*(\mathcal O_Y)(V)=\mathcal O_Y(\emptyset)=0$, meaning that $f_*(\mathcal O_Y)_x=0$. Hence $\mathcal O_{X,x}\to f_*(\mathcal O_Y)_x$ is surjective for every $x\in f(Y)$ if and only if it is surjective for every $x\in X$. However this is still not equivalent to $\mathcal O_{X}(U)\to f_*(\mathcal O_Y)(U)$ being surjective for every open $U\subseteq X$. I see that, even with the definition of the book, a closed immersion of schemes is a closed immersion of LRS, because if $\mathcal O_{X}(U)\to f_*(\mathcal O_Y)(U)$ is surjective for every open $U\subseteq X$, then $\mathcal O_{X,x}\to f_*(\mathcal O_Y)_x$ is surjective for every $x\in X$, and we said that this is equivalent to ($*$). However it seems unlikely to me that some books use a weaker definition, so my question is: does in this setting $\mathcal O_{X,x}\to f_*(\mathcal O_Y)_x$ being surjective for every $x\in X$ implies $\mathcal O_{X}\to f_*(\mathcal O_Y)$ being surjective for every open $U$? Thanks in advance