I would like to know if I understand closed immersions correctly. Let $f:X \rightarrow Y$ be a morphism of schemes (or locally ringed spaces in general). The morphism $f^\sharp:\mathscr{O}_Y \rightarrow f_*\mathscr{O}_X$ is surjective by definition and so all maps $f_x^\sharp: \mathscr{O}_{Y,f(x)} \rightarrow \mathscr{O}_{X,x}$ on stalks are surjective, so $\mathscr{O}_{X,x}$ is a quotient of $\mathscr{O}_{Y,f(x)}$.
Is it true that $f_x^\sharp$ induces an isomorphism of residue fields $k(f(x)) \simeq k(x)$ for all $x \in X$?
I think it should because since $f_x^\sharp$ is surjective, the map $\mathscr{O}_{Y,f(x)} \rightarrow \mathscr{O}_{X,x}/\mathfrak{m}_{X,x} = k(x)$ is surjective and since $f_x^\sharp$ is local, the kernel of this map is $\mathfrak{m}_{Y,f(x)} = (f_x^\sharp)^{-1}(\mathfrak{m}_{X,x})$ and so $k(f(x)) \simeq k(x)$.