in reply to Re^3: system() issue
in thread system() issue

Also make sure you close your files in sub1.