By default, Metro apps are suspended if they're not active (currently have focus). I used Spy++ to identify the proper keycode sequence to post which simulate ALT+F4, but unless the Metro App currently has focus, the messages are ignored. So basically, using acSendKeys("%{F_4}") is the only method to properly close a Metro app, but it must be active.
Also, note that WM_CLOSE does effectively crash the app, which gives the app a reported crash; too many crashes and an app may be reviewed by Microsoft, so I highly recommend using a modified script to check if the process is a Metro app and send ALT+F4 instead of acCloseApplication():if acIsImmersiveProcess(acGetOwnerWindowByPoint(gsx,gsy)) == 1 then
acActivateWindow(nil, gsx, gsy)
acSendKeys("%{F_4}")
else
acCloseApplication(nil, gsx, gsy)
end
Of course, the script above doesn't consider the window's current focus/active state, but is just for illustrative purposes.
EDIT: Added call to activate the Metro app before sending ALT+F4...seems to work well on my initial testing.