Don't use chmod to allow user to read-write the device. Instead, have the root user perform the flash.