A GPIO that was previously turned ON using gpio set command will turn OFF automatically when a gpio read command is executed on it. This is an expected behavior. In fact, the GPIO is not actually turned OFF, rather the GPIO is put in to INPUT mode by the firmware. When a GPIO is in INPUT mode, it goes in to high impedance state so it can accept voltages applied externally. This cause the GPIO to loose any previously set OUTPUT state. This is true of OFF state as well but is less noticeable.