esp8266: Reset term_obj on reboot.

Also, term_obj can be NULL if socket enables REPL duplication signalling
before os.dupterm is called, so it should be checked.
diff --git a/esp8266/main.c b/esp8266/main.c
index bf68ebc..bb28246 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -52,6 +52,7 @@
     memset(MP_STATE_PORT(fs_user_mount), 0, sizeof(MP_STATE_PORT(fs_user_mount)));
     #endif
     MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
+    MP_STATE_PORT(term_obj) = MP_OBJ_NULL;
 #if MICROPY_MODULE_FROZEN
     pyexec_frozen_module("boot");
 #endif