Don't call delete directly on a QWidget subclass that has already been created

This is unsafe since in some scenarios, the window is already part of
an event loop.