Added functions to remove dynamically added tabs on patient switch