How to stop running this macro after open an app in shell script?

I want to Execute a shell:

#!/bin/bash
export https_proxy=http://127.0.0.1:1088;export http_proxy=http://127.0.0.1:1088;export all_proxy=socks5://127.0.0.1:1088
nohup /Applications/spotube.app/Contents/MacOS/spotube &

The spotube will be running in proxy mode. But this macro is running all the time until I close spotube. Is that possible to stop running this macro automatically after open the spotube?