##QBIC, 70 bytes
QBIC, 70 bytes
open"r",1,"a.b" $get#1,1,e|~e=0|e=z\e=e-1]?e~e=0|$error 1|]$put#1,1,e| Opens file a.b (or creates it when not found on first run), reads record 1 into e. If that record is not found, assume 10, else sub 1. At e==0, raise an error. Write back e to a.b.
File access is not built into QBIC, this relies heavily on the underlying QBasic.