close ws on unload.