Added locks on the setpwalletRegistered functions in main.cpp and added an UnregisterAllWallets function.
Calling UnregisterAllWallets() instead of UnregisterWallet(pwalletMain) in init.cpp
Move core implementations to core.cpp
Merge pull request #2792 from sipa/coreimpl

Move core implementations to core.cpp
Merge pull request #2209 from CodeShark/WalletRegistrationLocks

Wallet registration locks in main.cpp + UnregisterAllWallet() function