fix close method bug