Same answer as the one given by twistor59, but written in a differential form language. By definition, $F=dA$, so

$d(A \wedge F)=dA \wedge F + A \wedge dF= F \wedge F$

where we used $dF=0$ (because $d^2=0$).

Same thing in the non-abelian case, as suggested in a comment by ruifeng14. By definition, $F=dA + A \wedge A$, so

$d(Tr(A \wedge dA + \frac{2}{3} A \wedge A \wedge A) = Tr(dA \wedge dA + 2 dA \wedge A \wedge A )$

$=Tr(F \wedge F)$

where we used the cyclicity of $Tr$ to rearrange the terms like $Tr(A \wedge dA \wedge A)$ and to obtain the vanishing $Tr(A \wedge A \wedge A \wedge A)=0$.

The expression $Tr(A \wedge dA + \frac{2}{3} A \wedge A \wedge A) = Tr(A \wedge F -\frac{1}{3} A \wedge A \wedge A)$, which reduces to $A \wedge dA= A \wedge F$ is the abelian case, is called the Chern-Simons Lagrangian.