Clean up global datastructures at shutdown.

This should make detecting leaks much easier.
Move GenerateBitcoins() call out of net.cpp's StartNode()

The internal miner is closely bound to the wallet engine,
not the blockchain engine.
Bitcoin-Qt: only use qApp for Q(Core)Application::instance()
Merge pull request #2431 from jgarzik/gen-bitcoins-init

Move GenerateBitcoins() call out of net.cpp's StartNode()
Merge pull request #2420 from sipa/globclean

Global cleanups
Merge pull request #2448 from Diapolo/Qt_qApp

Bitcoin-Qt: only use qApp for Q(Core)Application::instance()