Kicad process doesn't exit cleanly after using the plugin
In wxWidgets the main event loop doesn't end unless all top level windows are destroyed. Your plugin doesn't destroy it's dialog window properly and it prevents kicad.exe from exiting.
dlg.panel.Destroy()
should be
dlg.Destroy()
and I recommend to do it in try/finally block