close function & fix js