Fixed bug where logging out didn't actually log you out.
Added callback for logging out so that app developers can take action.