I made a post that did not show up, the foam will do pretty much nothing for bass and minimal for highs.
You need mass and density or material and isolation for it to work.........you could do drywall and get some benefit, but with that sub and a single layer of drywall in the rest of the room, it will never block more than the walls and I can assure you, those walls are not blocking a lot.
If you are set on plugging the windows to give it a try, foam will do about nothing to block sound.
I am sure, some one could show you how to build a window plug that will work on here, and be functional.
I can assure you, foam is not the way to do it.