fix close before open