Assume you have a smooth projective variety $X$ over the complex numbers, a smooth prime divisor $D$ on it, and a torsion free coherent sheaf $E$ on $X$ of rank $r>0$. Let $E|_{2D}:=E\otimes_{\mathcal{O}_X}\mathcal{O}_{2D}$, where $\mathcal{O}_{2D}:=\mathcal{O}_{X}/\mathcal{I}_{D}^2$, be the restriction of $E$ to the first order neighbourhood of $D$ in $X$.
If $E|_{2D}$ is a locally free $\mathcal{O}_{2D}$-module of rank equal to $r$, can we conclude that $E$ is locally free in a (Zariski) neighbourhood of $D$ (necessarily of rank $r$)?
Does it change anything if we assume $X$ is a surface and/or that $E$ is semistable?