Added locks on the setpwalletRegistered functions in main.cpp and added an UnregisterAllWallets function.
Calling UnregisterAllWallets() instead of UnregisterWallet(pwalletMain) in init.cpp
Merge pull request #2209 from CodeShark/WalletRegistrationLocks

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