Check for valid background task before ending on background task expiration.