You solution can open only 4 files ( count of files == count of threads)