added function to close a panel if we're in the RTE