delete flat_gallery and open file at beginning