The theorem $8.15$ (p.177) from the Hartshorne's book "Algebraic Geometry" says:
" Let $X$ be an irreducible separated scheme of finite type over an algebraically closed field $k$. Then $\Omega_{X/k}$ is a locally free sheaf of rank $n= \dim \ X$ iff $X$ is nonsingular variety over $k$."
Proof: If $x\in X$ is a closed point, then the local ring $B =\mathcal{O}_{x,X}$ has dimension $n$, residue field $k$, and is a localization of a $k$-algebra of finite type. Furthermore, the module $\Omega_{B/k}$ of differentials of $B$ over $k$ is equal to the stalk $(\Omega_{X/k})_x$ of the sheaf $\Omega_{X/k}$· Thus we can apply (8.8) and we see that $(\Omega_{X/k})_x$ is free of rank $n$ if and only if $B$ is a regular local ring. Now the theorem follows in view of (8.14A), which says any localization of a regular local ring at a prime ideal is again a regular local ring. and (Ex. 5.7), which says that $\Omega_{X/k}$ is locally free iff $(\Omega_{X/k})_y$ is free for all $y\in X$.
My confusion lies in the last sentence, I can see if $\Omega_{X/k}$ is a locally free sheaf of rank $n= \dim \ X$, then by (Ex. 5.7), $(\Omega_{X/k})_x$ is free of rank $n$ for any closed point, thus $\mathcal{O}_{X,x}$ is a regular local ring at each closed point. Now apply (8.14A), we know $\mathcal{O}_{X,x}$ is a regular local ring at non-closed points, thus $X$ is nonsingular. However, I feel confused with the other direction: Suppose $X$ is smooth, then by (8.8), we know $(\Omega_{X/k})_x$ is free of rank $n$ for any closed point $x$. But how do we show $(\Omega_{X/k})_x$ is free of rank $n$ for any nonclosed point? Here to apply (8.8), it requires $k(x)=k$, but which is true for closed points. I don't think we can use (8.8) for non-closed points.