Raise IOError if failed to write firmware