Added common unloadPreviousState function to remove old supapps.