adding sync to file, as kqueue error because of a lot of files open