Let $X$ be a scheme. In this answer it is stated (under the condition that $X$ is integral) that $\mathcal O_X (U) = \bigcap_{x \in U} \mathcal O_{X,x}$.
Since we're taking an intersection over all points in $U$, it seems that it might be enough to take the intersection over all closed points, since (locally) closed points correspond to maximal ideals, in which case the stalk is smaller. Is this true?
I don't understand why we need that $X$ is integral for the above equality to hold, so I am worried I am overlooking something.