I understand other methods of achieving the result, but this was my first try. I'm not sure where my mistake is, if any. And yes, I realize that using the fact that $B$ is closed would help.
For a compact set $B$, let $A \subset B$ be closed. Thus for each open cover of $B$, we have $B \subset \cup_{i=1}^{n} G_i$ (NOTE: originally, I made a typo and said this was A; editted to B) for finite $n$ and open sets $G_i$. Let $U$ be an open cover for $A$, then $U \cup W$, with $W$ open, is an open cover for $B$. Since $U \cup W$ is a open cover for $B$ and $B$ is compact, then $U \cup W$ is composed of finitely many open sets. For if $U$ can be composed of an infinite number of open sets, then the union of a infinite number of open sets and an open set would mean $B$ is not compact. Thus A is compact.
In general, as Asaf pointed out, there are several spots that aren't very clear. That being said, I'll try my best to read between the lines and comment on claims I think you're making, and spots that I suspect you're confused.
You're being cavalier with your $G_i$. Taken at face value, it almost seems like you've established what you want to prove: For $A$ to be compact, all you need to show is that any open cover of $A$ can be pared down to a finite open cover, and it looks like that's what you're claiming by the second sentence. Even so, it's not clear that $G_i$ are at all related to the original open cover of $A$; of course you can cover $A$ with finitely many open sets (but it needs to be proven that they can be taken from the given open cover).
Again: To be compact means that any open cover has a finite open subcover; that only finitely many sets are necessary. It doesn't mean that every open cover of a compact set has only finitely many sets (just that we can throw a bunch away while keeping the set covered).
Overall it seems like your argument was "If $A$ is covered by infinitely many open sets, then expanding this to a cover of $B$ must be contain infinitely many sets as well, contradiction." But this isn't a contradiction, it's just a fact! For a contradiction, you would need to show that the expanded open cover of $B$ couldn't be pared down to contain only finitely many of its constituent sets.