Fix {cowboy_req, resp_sent} potentially leaking in loop handlers