The taxation of capital income in an open economy: the importance of resident-nonresident tax treatment