The mode in which you are trying to close a file is not possible for that type of file.
Close the file with a new access mode which is compatible with that type of file, or execute a STOP RUN statement and recode your program.