Added try except statements to handle expected errors like
wifi disconnect.