synchronize write file process
use mutex