Working self-closing pop up window for closing threads