Samsung Foundry Nears Escape from Losses