Tube lemma generalization

So, here's the problem:

Let A and B be compact subspaces of X and Y, respectively. Let N be an open set in X x Y containing A x B. One needs to show that there exist open sets U in X and V in Y such that A x B U x V N.

Here's my try:

First of all, since N is open, it can be written as a union of basis elements in X x Y, i.e. let N = .

Then we cover A x B with basis elements contained in N, so that . Since A and B are compact, so is A x B, and for this cover, we have a finite subcover, so that .

Now we have the following relation:

.

Now, I'm not sure if this relation holds:

. If it does, then and are the sets we were looking for.

If x = (a, b) is in then a is in Ui, b is in Vi, for some i, and a is in Ui' and b is in Vi'. So, a is in the intersection of Ui and Ui', for some i, and b is in the intersection of Vi and Vi', for some i, i.e. in their unions, so x is in .

Does this work?

Edit: just edited this message, sorry for the math-typing inconvenience before.