Electric-field tuning of the metal-insulator transition in ultrathin films of LaNiO3