improved tab close behavior