Next, a potential higher than or equal to GND is supplied to the terminal 321. For example, GND is supplied. Since the potential of the wiring 259 is a negative potential, the potential of the gate of the transistor becomes a negative potential. Accordingly, the transistor 323 (transistor 323a) is turned off. Even when power supply to the memory device 300 (memory device 300a) is stopped after that, the transistors 323 (323a) and 262 can remain off.