Good idea. I also found that putting the 'regular' output to the browser at the end of the main script minimised the problem. I've seen this recommended for other reasons.
Also, to exit from &carpout. You can end up with two messages as well as duplicate headers (one message saying 'success' and another saying 'fail')!
Many thanks, wfsp.