Close the rest response at the end of the handler