Controlling charge-density-wave states in nano-thick crystals of 1T-TaS2