Here is the code:
var newTab;
chrome.tabs.create({url: (newUrl)}, function(tab){
newTab = tab.id;
});
check();
alert(newTab);
chrome.tabs.update(newTab, {pinned: true});
chrome.tabs.update(tabid, {active: true});
chrome.tabs.remove(newTab);
The final instruction doesn't work. the newTab variable doesn't update so that is can be pinned and then remove.