implement close method