Ensured shutdown of location services on loss of foreground.