removed duplicate close function