fix a bug of file leak