The destructor of BitcoinGUI gets called when the object goes out of scope.
Feel free to verify this and prove me wrong (this would be a bug).

The proper idiom here would be a "weak pointer". But explicitly setting it
to null to prevent a dangling pointer is ok.