Foreigners snap up record number of US homes