When the application that created the tray icon terminates, Windows does not automatically delete the tray icon. This only happens when the user hovers over it and notices that the ownership process no longer exists.
To make sure the icon is removed immediately, you must call systemTray.remove(yourIcon) when your program is complete.
source share