Flush the pipe to the child in send_mail before closing the input.