I loaded up your script and didn't see any issues other than redefining modifier keys. You don't need to list LAlt, LCtrl LShift as modifiers, they are inherently modifier keys to HKN.

I spammed a bunch of keys on the loading screens and none of my games froze up, which points to an issue with the game install itself, an addon or possibly your system. There's nothing in the script that actually does anything different to that window over any other.