I am making my comment an answer.  The specified set is not Zariski closed.  If it were, then its intersection with every Zariski closed subset $C$ would be relatively closed in $C$.  But now let $C$ be the curve, a copy of the affine line, where the first component $A$ is held fixed as the identity $n\times n$ matrix, and the second component is a varying diagonal matrix whose first $n-1$ diagonal entries all equal $1$, yet whose last entry $t$ varies in a copy of the affine line.  The intersection of $C$ with the specified set is a non-closed, dense Zariski open in $C$, namely the open subset where $t$ is invertible.