Setting autoflush ($|=1) is not being done on OUTFIL. See select.
close(OUTFIL) will never be reached due to the while (1) {...}.
With those items, it is possible that your output buffer is just not full, so the data is never flushed to disk. Add that to Joost's exhortations, and see what you come up with.