Viscosity Solutions to Master Equations and McKean-Vlasov SDEs with Closed-loop Controls