Most likely you opened the file previously within the program somewhere. However, if you have a program that uses the same file and it is being run as a previous job step within a PROC or procedure, and that step abends it can leave the file opened. If you are using IBM COBOL on a mainframe there is a utility called IEFBR14. It can be used to reset or close the file if a previous step using the file abends. It can be run conditionally or just run. If the file is closed it does nothing. If it is still opened it will close it. Set the disposition of the file to (OLD, KEEP,KEEP) in the IEFBR14 job step.