batch write and free err string