See
http://jqueryui.com/demos/tabs/ for how to use jQuery UI's tabs. At a glance, it looks like you will want to use the tabTemplate option to add a close button to the tab, and then handle the click of the close button to remove the tab. To remove a tab, there is a API call called remove().
All this work would be in gab.
js. You'd probably want to modify the calls to .tabs('add',....).