close storage connection on request end

Due to flask, connections cannot be reused between requests.
We therefore have to close them on the end of every request.
A caveat is that sometimes the stream generator functions
have to take care of that.