Fix memory leak when constructing load file dialog