open the device write first