added close function