Lie's criterion tells us that $(q,p) \to (Q,P)$ is a canonical transformation, for a system with Hamiltonian $H$ and "Kamiltonian" $K$, if and only if the identity $$\sum_k p_k dq_k -Hdt = \sum_k P_k dQ_k - Kdt + dF \tag{1}$$ is satisfied, where $F$ is a suitable generating function. All textbooks I have consulted so far tell me that if the transformation is time independent, i.e. $$\frac{\partial Q_k}{\partial t} = \frac{\partial P_k}{\partial t} = 0, \quad \forall k, \tag{2}$$ then we may choose $F$ such that $$\frac{\partial F}{\partial t} =0, \quad \text{and thus} \quad K = H. \tag{3}$$ However, I have not yet found a thorough explanation of why exactly this should be the case, and I'm having a hard time determining the necessary steps – which I nevertheless expect to be very trivial. How can this be justified?
EDIT: After pondering on both answers some time, I might have found a proof that $K = H$. Take $F = F_2(q,P,t)$ as generating function (second type): then for $ k = 1,\dots,n$ $$\begin{cases} p_k = \dfrac{\partial F}{\partial q_k}, \\ Q_k = \dfrac{\partial F}{\partial P_k}, \\ K = H + \dfrac{\partial F}{\partial t}. \end{cases} $$ Differentiating the last relation w.r.t. $P_k$ for some $k$ and applying Schwarz's lemma yields $$\frac{\partial^2 F}{\partial P_k \partial t} = \frac{\partial K}{\partial P_k} - \frac{\partial H}{\partial P_k} = \frac{\partial^2 F}{\partial t \partial P_k } = \frac{\partial Q_k}{\partial t} = 0 $$ so we get $$\frac{\partial K}{\partial P_k} = \frac{\partial H}{\partial P_k}. \tag4 $$
By similar arguments, using the generating function $\tilde F = F_3(p,Q,t)$, one obtains the similar identity $$ \frac{\partial K}{\partial Q_k} = \frac{\partial H}{\partial Q_k}. \tag{5} $$ Integrating $(4)$ and applying the FTC we obtain $$\int \frac{\partial K}{\partial P_k} dP_k = \int \frac{\partial H}{\partial P_k} dP_k \quad \implies K = H + c(Q,t), \tag{6} $$ where we have iterated the integration over $P_k$ for all $k = 1,\dots,n$ in order to completely remove the dependency of $c$ from $P$. Differentiating $(6)$ w.r.t. $Q_k$ yields $$\frac{\partial K}{\partial Q_k} = \frac{\partial H}{\partial Q_k} + \frac{\partial c}{\partial Q_k}, $$ which, by comparison with $(5)$, implies $$\frac{\partial c}{\partial Q_k} = 0 \quad \forall k, \quad \implies \quad c = c(t). $$ By the "third" (or $(2n+1)$-th) relation for $F$, $$\frac{\partial F}{\partial t} = c(t), $$ so that $$F(q,P,t) = \Phi(t) + C(q,P),$$ where $\Phi$ is such that $d\Phi/dt = c$. However, by the variational principle, the $F$ had to be chosen such that $\delta F|_{t_1}^{t_2} = 0$, for two consecutive times $t_1 < t_2$, hence we must have $$\delta F|_{t_1}^{t_2} = \delta \Phi|_{t_1}^{t_2} + \delta C|_{t_1}^{t_2} = \delta \Phi|_{t_1}^{t_2} = 0 $$ One such choice of $\Phi$ is the identically vanishing function; in other words, the new function $\hat F = F - \Phi$ generates the same canonical transformation as $F$ (which may be seen by differentiating $\hat F$ w.r.t. $q_k$ and $P_k$). This completes the proof.