Avast free antivirus keep shuttingdown Autohotkey

Run, steam://rungameid/392160
Loop {
    IfWinExist, x4.exe ; when x4 foundations exist, send mouse button key function
    {
        XButton1::End ; targeting substem
        XButton2::h ; Engine halt
        return
    }
    else{
        ; when game is off exit autohotkey
        {
            WinClose, ahk_exe 
        }
    }
}

Windows 11 pro build22631
Ryzen 5600X
64Gb ram
rtx3070
avast 23.6.6070 build 23.6.8271.788

Hi, I wrote this simple script because LogiOptions’s key mapping is not working properly.
Game start normally when I excuting it
as soon as I use mouse button the game shutdown and script is deleted.
I add the script to exception list but game still crash and only script is remained.