make close function private