On the Determinants of External Imbalances and Net International Portfolio Flows: A Global Perspective