send.php: adding periodic flush and atomic file renames