What do these marks indicate exactly on these tray icons when I run Python from a terminal?
The short arrow is indicating alias. Some like that are also there in my Applications folder for apps which are located in ~/Library folder.

So I can guess that when first photo's original process is done, alias is still active. This happens to me while using OpenCV. closewindow() is hard to perform. I have to force quit it every time(it kills jupyter server too), or reuse the window.