Merged faritka changes to prevent problems related to the *CLOS* statement.
Now always check for the "CLOS" statement, connected or not.