Fixing issue when file is overwritten (thanks to fork()).