US packaged food maker General Mills is to close its Brazilian pasta and bread businesses with the loss of 500 jobs.