put file write into background thread.