function undefinePrimaryNetwork, to avoid the Failed to destroy network error added a check to see if the primary network is running