Fix for issue 539, adds atomic operation for changing wallet encryption key/password.