Let $M$ be an $n$-dimensional manifold. I am proving the statement "If $f:M\to\mathbb{R}^n$ is smooth and $M$ is compact then $f$ cannot have full rank." In other words its differential $DF:T_pM\to T_{f(p)}\mathbb{R}^n$ cannot be injective for some $p\in M$. Is my proof below sound?
Suppose $f$ has full rank. Then the inverse function theorem says that $f:M\to\mathbb{R}^n$ is a local diffeomorphism. This guarantees the existence of a collection of open sets $\{U_{\alpha}\}$ in $M$ such that $f\vert_{U_{\alpha}}:U_{\alpha}\to f\vert_{U_{\alpha}}(U_{\alpha})$ is a diffeomorphism. By continuity $f(M)$ is compact in $\mathbb{R}^n$ but at the same time it is also the union $\cup_{\alpha}f\vert_{U_{\alpha}}(U_{\alpha})$ with each $f\vert_{U_{\alpha}}(U_{\alpha})$ being open. This appears to be a contradiction.