Let $X$ be a smooth, connected, complex analytic variety, and $Y\subset X$ a closed, analytic subvariety of codimension at least 2. Now let $V\subset X\backslash Y$ be a closed, analytic subvariety. Is the closure $\bar{V}$ of $V$ in $X$ also analytic?
Motivation: In the case where $X$ is a surface, this seems to follow from Riemanns extension theorem, and perhaps it can even be proven this way. But it'd be nice if there were a reference (or if I'm missing something and this is false in general!)
Thanks!