close plt after every iteration