added close function to call