[fix] cleanup and stylize close function