BS: Removing applications from the cache if there are no running tasks left