I don't know why this happens; it doesn't happen on my Windows machines. To avoid this problem, don't open the script in PixInsight's Script Editor. Instead, create a Script instance with the script's file path and no MD5 checksum. This way you can execute the script globally by hitting F6.