Fix raw buffer data write to dest file incomplete