Address an obvious memory leak.

There are probably others, but this one is big.

The 'window' variable is an instance of a jquery-ized DOM.
In the original code this is treated as a global but what we
really want is a window per request, one that gets thrown away
after the request is handled.