Merge changes Ib3d70d21,I005c7665,I41bbcff0

* changes:
  Fixes switch-user -w command.
  Improved 'am switch' to handle errors.
  Add wait flag to am switch-user command.