added close tab and switch control to new tab method