The time evolution of a system in classical mechanics is given by the solution of Hamilton's equations of motion, which tell us that $$\frac{\mathrm{d}p}{\mathrm{d}t}=-\frac{\partial H}{\partial q},\qquad \frac{\mathrm{d}q}{\mathrm{d}t}=\frac{\partial H}{\partial p}.$$
Now, divide the first equation by the second, to obtain $$\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\frac{\partial H}{\partial q}}{\frac{\partial H}{\partial p}},$$
and now after a manipulation we arrive at $$\frac{\partial H}{\partial p}\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\partial H}{\partial q}, $$
and multiplying both sides by $\mathrm{d}q$ and doing an addition we arrive at
$$\frac{\partial H}{\partial q}\mathrm{d}q+\frac{\partial H}{\partial p}\mathrm{d}p=0, $$
which is an exact differential, because of the symmetry of partial derivatives, and we thus must have $\mathrm{d}H=0$. This implies that $H$ is time independent, since it is well known that the total time derivative of the Hamiltonian is equal to its partial time derivative.
This argument obviously is wrong, time-dependent Hamiltonians are obviously allowed. Where's the mistake?