[fix] handle close more gracefully