Counterfactual Invariance to Spurious Correlations in Text Classification