Fix to issue whereby fileupload end handler was sometimes called after body end handler