Fix memory leak when restart.txt is not present