Try this
Code:
Ext.onReady(function(){
    var tab = Ext.create('Ext.tab.Panel', {
        renderTo : Ext.getBody(),
        width: 300,
        height: 200,
        id: 'tabpanel',
        activeTab: 0,
        items: [{
            title: 'Tab 1',
            bodyPadding: 10,
            closable: true,
            html : 'A simple tab',
            id: 'tab1'
        }],
        listeners: {
            render: function(tabs){
                tabs.getTabBar().add({
                    xtype: 'button',
                    text: '+',
                    handler: function(){
                        var tab = tabs.add({
                            title: 'Tab'+ (tabs.items.length + 1),
                            closable: true,
                            html: 'New tab',
                            listeners : {
                                close: function (tab) {
                                    if(tab == tabs.getActiveTab()){
                                        Ext.defer(function(){
                                            var len = tabs.items.length-1;
                                            tabs.setActiveTab(len);
                                        }, 1);
                                    }
                                }
                            }
                        });
                        tabs.setActiveTab(tab);
                    }
                });
            }
        }
    });
});