File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/gui/qt/main_window.py", line 2782, in closeEvent
    self.clean_up()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/gui/qt/main_window.py", line 2800, in clean_up
    self.gui_object.close_window(self)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/gui/qt/__init__.py", line 334, in close_window
    self.daemon.stop_wallet(window.wallet.storage.path)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/daemon.py", line 448, in stop_wallet
    wallet.stop_threads()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/wallet.py", line 290, in stop_threads
    self.storage.write()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/util.py", line 424, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/util.py", line 420, in do_profile
    o = func(*args, **kw_args)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/storage.py", line 115, in write
    self._write()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/electrum/storage.py", line 125, in _write
    with open(temp_path, "w", encoding='utf-8') as f: