On weakly S-embedded and weakly τ-embedded subgroups