Please read the following:
Every compact set is closed. So the union of all compact sets is closed? If that's so, then a compact space, which is basically the union of the compact sets, is closed, right?
If your topological space is a standard topology on , then a subset A of is compact if and only if it is closed and bounded.
More generally, if a topological space X is a compact Hausdorff space, then a subset A of X is compact if and only if it is closed. In this case, as Abstractionist mentioned, finite unions of compact sets is compact.
However, open sets can be compact sets. For example, in a cofinite topology on , compact sets are not necessarily closed sets.