Checking to make sure menuElement is defined in close function