Hi, better late than never, right?
Let's imagine two cases:
1. There is a hole in the wall (no glass, nothing, just wall geometry with a hole) and background behind it.
2. There is a hole in the wall with glass in it (like in the original example here).
If we render case 1 - the wall will be white in the alpha channel and the hole will be black.
If we render case 2 - the wall will be white, the hole will be black, but there will be some shade of gray where there is glass because the glass is not 100% transparent - it has some reflectivity.
If you imagine that there is a person in the room, standing next to the window, you would see this person's reflection in the window.
If you want to replace the background, you want to see the background behind the glass, but you also want to see the reflection of the person - right?
That's why the glass cannot be 100% black.
To overcome this, we can use the "trick" provided by dj_buckley. The directly visible background will be black, so no additional color will be added on top of the glass if you apply the alpha.
I hope this helps.