Let $X$ be a compact complex $n$-manifold and $D$ be a smooth comdimension $1$ submanifold. Also let $U:= X\setminus D$ and $j$ be the inclusion of $U$ in $X$. 
Then it is well known that the following (long exact) sequence respects mixed Hodge structures:


$$ \cdots\to H^{k-2}(D)(-1)\stackrel{\gamma\_k}{\to}H^k(X)\stackrel{j^\*}{\to}H^k(U)\stackrel{\text{Res}}{\to}H^{k-1}(D)(-1)\to\cdots.$$


Here $\gamma\_k$ is the Gysin map obtained as the Poincare dual of $H^{2n-k}(X)\to H^{2n-k}(D)$. And $\text{Res}$ is the residue map that knocks off a factor of type $\frac{dz}{z}$ from a form.


My question: Where does one needs compactness of the manifold/ variety $X$? If one were to work with non-compact $X$, would the above sequence respect the mixed Hodge structure?



The compatibility of the Gysin sequence with mixed Hodge structures
Yes, it's fine also if $X$ is not compact. More generally you have for any variety $X$ and subvariety $Z$ a long exact sequence
$$ \ldots \to H^k\_c(X \setminus Z) \to H^k\_c(X) \to H^k\_c(Z) \to H^{k+1}\_c(X \setminus Z) \to \ldots $$
of mixed Hodge structures, which gives your long exact sequence by Poincaré duality when $X$ is smooth and $Z$ a smooth divisor. 


