Improve menu close functions