Here I am using de Rham cohomology. This question occured to me while reading the proof of the exactness of the short exact sequence in the Meyers Vitoris sequence
$0 \rightarrow H^{n}(X)\,\xrightarrow{i}\,H^{n}(U)\oplus H^{n}(V)\,\xrightarrow{j}\,H^{n}(U\cap V)\rightarrow 0$
Where $j$ is defined by $j(\theta, \tau)=\theta - \tau$. In Bott and Tu specifically (and other proofs I looked at trying to see what was happening) to prove the surjectivity of $j$ take a closed differential form on $U\cap V$, $\omega$ lets say, and then take a partition of unity $\rho_U, \rho_V$ of $X$. Then $(\rho_U \omega , -\rho_V \omega)$ should be the element in $H^{n}(U)\oplus H^{n}(V)$ mapping to $\omega$. However it is not clear to me at all that $\rho_U \omega$ is a well defined smooth form on $U$, because there are, for example, functions smooth on subsets of $\mathbb{R}$ that cannot be extended smoothly to full space e.g. $tan(\theta), x^{-1}$ and so on. So is it different for closed forms?? Can a closed differential form on a subset of manifold always be extended to the whole manifold?