Rationality of W-algebras: principal nilpotent cases