Gauge invariance of the Hamiltonian

Consider a Lagrangian $L(x,\dot x,t)$ and a corresponding Hamiltonian $H=\dot xp-L$ where $p=\partial L/\partial \dot x$ which satisfies Hamilton's equations $$\frac{\partial H}{\partial x}=-\dot p$$ $$\frac{\partial H}{\partial p}=\dot x.$$ I'm trying to show that Hamilton's equations are unchanged by a gauge transformation of the Lagrangian $L'=L+ \frac{dF}{dt}$ where $F(x,t)$ is a function of the position and time only. I first expand the derivative of $F$ $$\frac{dF}{dt}=\frac{\partial F}{\partial t}+ \frac{\partial F}{\partial x}\dot x$$ the new conjugate momentum is $$p'=\frac{\partial L'}{\partial \dot x}=\frac{\partial L}{\partial \dot x}+\frac{\partial}{\partial \dot x} \frac{dF}{dt}=p+ \frac{\partial F}{\partial x}$$ and so $$\frac{\partial}{\partial p'}= \frac{\partial p}{\partial p'} \frac{\partial}{\partial p}=\frac{\partial}{\partial p}$$ The new Hamiltonian is $$H'=p'\dot x-L' = p \dot x-L+\frac{\partial F}{\partial x} \dot x - \frac{dF}{dt}=H- \frac{\partial F}{\partial t}$$ Hamilton's equations are then $$\frac{\partial H'}{\partial p'}=\frac{\partial H}{\partial p}- \frac{\partial}{\partial p} \frac{\partial F}{\partial t}=\dot x-0=\dot x$$ and $$\frac{\partial H'}{\partial x}=\frac{\partial H}{\partial x}- \frac{\partial}{\partial x} \frac{\partial F}{\partial t}= -\dot p-\frac{\partial }{\partial t} \frac{\partial F}{\partial x}$$ It is this last equation where I'm having trouble. To satisfy Hamilton's equations, the right side should be equal to $-\dot p'= -\frac{d}{dt}(p+\frac{\partial F}{\partial x})$ however I end up with a partial derivative on the last term rather than a total derivative as it should be. How can one justify this as satisfying Hamilton's equations?

Assuming $x,\dot x$ and $p'$ are independent we have $$\frac{\partial H'}{\partial x}= \frac{\partial}{\partial x } \left( p' \dot x-L'\right)= -\frac{\partial L'}{\partial x}=-\frac{\partial L}{\partial x}-\frac{\partial}{\partial x}\frac{dF}{dt}$$ By Euler-Lagrange: $$\frac{\partial L}{\partial x}= \frac{d}{dt} \left( \frac{\partial L}{\partial \dot x}\right) = \frac{d p}{dt}$$ Commuting the partial in $x$ and the total time derivative we get $$\frac{\partial H'}{\partial x}= -\frac{d}{dt} \left( p+ \frac{\partial F}{\partial x}\right)=-\dot p$$