Improve logic for opening new tab / window when application is already running