Apply fix for issue #10 - before we send any response, note down the fact that we're stopping the session. Make the download servlets wait on a Future for that task to be done