Fix segfault that occured when closing during menu