Apple wins big with US tax bill but faces snag on foreign patents