Apparent counter example to Stoke's theorem?

Solution 1:

Your $M$ is not compact, and $\omega$ is not compactly supported. So you have not contradicted Stokes's theorem.

Solution 2:

Congratulation! You found something which leads to idea of closed but not exact forms and cohomology groups.

To see the problem take $M= \overline{B^2(1)} \setminus B^2(\epsilon)$. Than $\partial M = S^1(1) - S^1(\epsilon)$. Now the Stokes theorems says: $$ \int_{S^1(1)} \omega - \int_{S^1(\epsilon)} \omega = \int_M d\omega $$ You might think that integral $\int_{S^1(\epsilon)} \omega$ goes to zero as $\epsilon$ goes to zero, but that is not true. In fact that integral does not depend on $\epsilon$, so you cannot omit it if $\epsilon$ is small.