Fixed bug with UI close process