Well, the local condition that $\omega\not=0$ be a nonzero multiple of an closed $1$-form is that $\omega\wedge d\omega = 0$. This is necessary and sufficient for the local existence of functions $f$ and $g\not=0$ such that $\omega = g\ df$. (This claim is just a special case of the Frobenius Theorem.)

For the global question, you are really asking whether a codimension $1$ foliation of a contractible open set is always the level sets of a function without critical points. This is certainly false in dimensions $3$ and higher, and I sort of remember that it's false in dimension $2$ as well, but I can't remember the example. (See It is already false in dimension $2$. I looked it up later; see the added remark below.)

Added remark: Your question is addressed by Exercises 5 and 6 of Section 16 of Chapter XVIII of Volume IV of Dieudonné's Treatise on Analysis. He gives the above local criterion and a counterexample to its global analog with an example of a $1$-form $\omega$ on $\mathbb{R}^2$ that is nonvanishing and yet cannot be written globally in the form $g\ df$ for two smooth functions on $\mathbb{R}^2$. Just to save you the trouble of looking it up, here is his example $$\omega = y^3(1{-}y)^2\ dx + \big(y^3-2(1{-}y)^2\bigr)\ dy.$$ The point is that , if you could write $\omega = g\ df$, then, away from the lines $y=0$ and $y=1$, the function $f$ would have to be a function of $$F = x + \frac{1}{y^2} + \frac{1}{1-y}$$ and $f$ would have to be constant on the lines $y=0$ and $y=1$. Now, you need to check that you can't rig an $f$ with these properties that is smooth and without critical points on the whole plane.

Well, the local condition that $\omega\not=0$ be a nonzero multiple of an closed $1$-form is that $\omega\wedge d\omega = 0$. This is necessary and sufficient for the local existence of functions $f$ and $g\not=0$ such that $\omega = g\ df$.

For the global question, you are really asking whether a codimension $1$ foliation of a contractible open set is always the level sets of a function without critical points. This is certainly false in dimensions $3$ and higher, and I sort of remember that it's false in dimension $2$ as well, but I can't remember the example(if there is one). (See the added remark below.)

Added remark: Your question is addressed by Exercises 5 and 6 of Section 16 of Chapter XVIII of Volume IV of Dieudonné's Treatise on Analysis. He gives the above local criterion and a counterexample to its global analog with an example of a $1$-form $\omega$ on $\mathbb{R}^2$ that is nonvanishing and yet cannot be written globally in the form $\omega = g\ g\ df$ for two smooth functions on $\mathbb{R}^2$. Just to save you the trouble of looking it up, here is his example $$\omega = y^3(1{-}y)^2\ dx + \big(y^3-2(1{-}y)^2\bigr)\ dy.$$

2 fixed a typo

Well, the local condition that $\omega\not=0$ be a nonzero multiple of an closed $1$-form is that $\omega\wedge d\omega = 0$. This is necessary and sufficient for the local existence of functions $f$ and $g\not=0$ such that $\omega = g\ df$.

For the global question, you are really asking whether a codimension $1$ foliation of a contractible open set is always the level sets of a function without critical points. This is certainly false in dimensions $3$ and higher, and I sort of remember that its it's false in dimension $2$ as well, but I can't remember the example (if there is one).

Added remark: Your question is addressed by Exercises 5 and 6 of Section 16 of Chapter XVIII of Volume IV of Dieudonné's Treatise on Analysis. He gives the above local criterion and a counterexample to its global analog with an example of a $1$-form $\omega$ on $\mathbb{R}^2$ that is nonvanishing and cannot be written globally in the form $\omega = g\ df$ for two smooth functions on $\mathbb{R}^2$.

1