simple problem, you want to check if a file has been /fopen 'd because the script halts if you try to open an already open file.
Problem is all the identifiers regarding the /fopen commands will halt when a non existing handle name is given. So writing a script with /fopen is useless. A Control-Break can prevent a script from closing the fopen file. And there is no way to check if it is open.
* Invalid parameters: $fopen