Capital flows and the business cycle