For the infinite case, if the family is uncountable, then we cannot use mathematical induction. Here is the proof for the general case (whether it is finite or infinite, countable or uncountable):
Let $\{U_i\}_{i\in I}$ be a family of open sets. Here $I$ can be finite, infinite, countable, or uncountable. We want to prove that $\cup_{i\in I}U_i$ is open.
To prove this, let $x\in\cup_{i\in I}U_i$. Therefore, $x\in U_i$ for some $i\in I$. Since $U_i$ is open by assumption, there exists an open rectangle $(a_1,b_1)\times(a_2,b_2)\times\cdots\times (a_n,b_n)$ such that
$$x\in (a_1,b_1)\times(a_2,b_2)\times\cdots\times (a_n,b_n)\subset U_i.$$
This implies that
$$x\in (a_1,b_1)\times(a_2,b_2)\times\cdots\times (a_n,b_n)\subset U_i\subset\cup_{i\in I}U_i.$$
Since $x$ is arbitrary, we have proved that $\cup_{i\in I}U_i$ is open.