This question turns out to be vacuous - no countable disjoint union of nonempty closed rectangles (in $\mathbb{R}^n$) can be connected.
Note that in the situation you describe, at least one of the connected components of $\bigcup B_i$ must cover infinitely many $A_i$s by pigeonhole, and each of these are connected; this is why the point above is relevant to your question. Specifically: there is no countable set $A_i$ of disjoint closed boxes such that their union can be written as a finite union of boxes of any type.
This is a consequence of the Baire category theorem; see e.g. Does not exist cover of $\mathbb{R}^n$ by disjoint closed balls.
To motivate this, let's look at the case $n=1$ in more detail.
Let's assume $\bigcup A_i$ is connected, where each $A_i$ is a nonempty closed interval; WLOG (why?) let's also assume that each $A_i$ is bounded. Then we define a subsequence $A_{i_k}$ as follows:
That is, we pick a subsequence of the $A_i$s that "zig-zags" appropriately.
Now let $I_n$ be the smallest closed interval containing both $A_{i_n}$ and $A_{i_{n+1}}$ (so, fill in the middle).
Then $\mathcal{I}=\bigcap I_n$ is an intersection of compact sets, so nonempty; but (exercise) any element of $\mathcal{I}$ is not an element of any $A_i$. But this is a problem - that means the $A_i$s don't fully cover the gap between $A_1$ and $A_2$, hence their union isn't connected.
Note that this proof, in fact, shows (with minor modifications) that in $\mathbb{R}^n$ the disjoint union of countably many compact sets is never compact. Exercise: is this true in an arbitrary topological space? What about uncountably many?