Is there a symplectic manifold $(M,\omega)$ equipped with a Riemannian metric such that $d^* \omega \wedge dd^*\omega=0$ and there is a compact leaf for the foliation of $M\setminus S$ defined by  $d^* \omega =0$  where $S$ is the singular points of $d^* \omega$?(The operator $d^*$ is the adjoint of the exterior derivative $d$).

In dimension $2$ the answer is negative since it leads to a gradient vector field, but a gradient vector field has no any closed orbit.