Maybe rename to shutdown handler and explain in a comment that this is called at the end of every request, regardless of whether there is an error