avoid close twice