by Tim Hunt.
Closing the DB connection sounds like a simple quick win, so I think we should do it now (although it seems you have looked in more detail than me and it is not completely simple.)
xsendfile support seems like an even better long-term option, and I am pretty sure there is already a tracker issue about that, but that is more complex, and seems to be taking a while, so doing the quick with first may be worthwhile.