 			exports.rescanDrives(callback)
 
 		(callback) ->
+			deviceFileStream = fs.createWriteStream(devicePath, flags: DISK_IO_FLAGS)
+			deviceFileStream.on('error', callback)
+
+			imageFileStream = fs.createReadStream(imagePath)
 			imageFileStream
 				.pipe(progress)
 				.pipe(deviceFileStream)

progressStream = require('progress-stream')

IS_WINDOWS = os.platform() is 'win32'

exports.rescanDrives = (callback) ->
	return callback() if not IS_WINDOWS

	async.waterfall([

		(callback) ->
			fs.open(devicePath, DISK_IO_FLAGS, null, callback)

		(fd, callback) ->
			buffer = new Buffer(bufferSize)
