QGC Custom App Instance doesnt close properly

I’m currently building a custom version of QGC for desktop. I packaged my custom build into an installer, and then installed the executable. My issue is that when i close the executable it keeps running in the background. On clicking the app again, i get the error “an instance is already running”. The only way around it is to kill the app in task manager. I figured its probably because of a memory leak somewhere in the app, has anyone had this issue or solved it?

You’re missing a line of code somewhere, it’s just not exiting correctly. I had the same issue in the 90s once, step through the code to find the problem