Hop on the discord if you want specific answers. It's pretty easy to create 2 separate autohotkey scripts, one to launch the software:
Run, Run, C:\arcade\sinden\Player1.lnk
and one to close it:
Process,Close,Lightgun.exe
Run,taskkill /im "Lightgun.exe" /F
WinActivate LaunchBox Big Box ;this line might not be needed but it can't hurt either.
You can use one as the startup app and one as the exit app. It's weird you mention Windows games not being in focus. I would try creating a shortcut to the lightgun.exe file and right clicking>properties>target and add -silent to the end of the target so it looks like this: C:\arcade\sinden\player1\Lightgun.exe -silent
That way the shortcut will launch the Sinden software minimized. I know there are some issues with the current software minimizing to tray so keep that setting off. Keeping the software minimized might help with the Windows games playing in the background.