It's sufficient show that for every point $x \in$ AB there exists a net $(x_\alpha)_{\alpha \in I}$ of points of AB such that $x_\alpha \rightarrow x$. Let $x = ab \in$ AB.
How A is closed exists a net $(a_\alpha)_{\alpha \in I}$ of points of A such that $a_\alpha \rightarrow a$. Analogously, how B is compact exists a net $(b_\sigma)_{\sigma \in J}$ of points of B such that some subnet $(b_{g(\beta)})_{\beta \in K}$ is such that $b_{g(\beta)} \rightarrow$ b.
Consider then the set $I \times K$. This is parcially ordered in the following way: $(\alpha, \beta) \le (\theta, \psi)$ iff $\alpha \le \theta$ and $\beta \le \psi$.
$\rho : I \times K \rightarrow G \times G$ given by $\rho(\alpha, \beta) = (a_{\alpha}, b_{g(\beta)})$. This application is a net that converges to $(a, b)$. Let $\cdot$ the operation of the group. Then $\cdot \circ \rho : I \times K \rightarrow G$ is a net of points of AB such that $\cdot \circ \rho \rightarrow $ ab.
Therefore, AB is closed. (Correct ?).