Only try to end the backgroundTask if the app is in the background
Only try to end the backgroundTask if the app is in the background

amplitude/Amplitude-iOS,amplitude/Amplitude-iOS,amplitude/Amplitude-iOS,amplitude/Amplitude-iOS