Does a Hamiltonian-preserving, symplectic vector field provide an integral of motion?

Consider the hamiltonian system $$(M, \omega, H)$$ with hamiltonian vector field $$X$$ defined by $$\tag{1}\label{1} \iota_{X}\omega = -dH$$ It is a simple matter of applying definitions to show that a smooth function $$f$$ on $$M$$ is an integral of motion $$\mathscr{L}_X f = 0 \tag{2} \label{2}$$ iff its hamiltonian vector field $$Z$$, defined by $$\iota_Z \omega = -df \tag{3}\label{3}$$ preserves the Hamiltonian $$H$$, that is $$H$$ is pull-back invariant along the flow of $$Z$$, or $$\mathscr{L}_Z H = 0 \tag{4}\label{4}$$

Indeed: $$\begin{split} \mathscr{L}_X f = X(f) & = df(X) \\ & = - \iota_Z \omega \, (X) = -\omega(Z,X) = \omega(X,Z) = \iota_X\omega \, (Z) \\ & = -dH(Z) = -Z(H) = - \mathscr{L}_Z H = 0 \quad \square \end{split}$$ where \eqref{3} is used at the first line, \eqref{1} at the second and \eqref{4} at the last to conclude \eqref{2}.

Since exact forms are closed, hamiltonian vector fields are symplectic by Cartan's magic formuala: $$\mathscr{L}_Z\omega = \iota_Zd\omega + d\iota_Z\omega = 0$$ where the first terms vanishes being $$\omega$$ closed per definition, and the second being $$\iota_Z \omega$$ exact, so closed, by \eqref{3}.

There is thus a 1-to-1 correspondence between integrals of motions and hamiltonian (in particular symplectic), Hamiltonian-preserving vector fields.

Can I weaken this assumption? Is it enough to have a Hamiltonian preserving, symplectic vector field $$\mathscr{L}_Z H = 0, \quad \mathscr{L}_Z \omega = 0$$ to obtain a constant of motion? In other words, is this enough to make $$Z$$ hamiltonian? Of course the answer is yes if the first de Rham cohomology group is trivial, since then 1-forms are closed iff exact and vector fields are symplectic iff hamiltonian; but what if this is not the case?

I'm pretty sure the answer lies in the moment map, but I was trying to come up with an intuitive answer before studying it.

No, it's not. For example, take $$M = \mathbb{R}^2\times(S^1\times\mathbb{R})$$ with the symplectic form $$\omega = dx\wedge dy + \alpha\wedge dz$$, $$H=H(x,y)$$, and $$Z=\frac{\partial}{\partial z}$$. Here $$\alpha$$ is the closed 1-form that takes value 1 on $$\frac{\partial}{\partial\theta}$$: informally, $$\alpha=d\theta$$, although this is only true in a coordinate patch. Then $$\mathscr{L}_ZH=0$$ and $$\mathscr{L}_Z\omega=0$$. But $$i_Z\omega = -\alpha$$, and $$\alpha$$ is not actually an exact form (since its integral around $$S^1$$ is 1). So there's no corresponding globally defined integral of motion. Locally, we can say the integral of motion is $$\theta$$. However this can't be extended to a globally defined function.