attempt to fix broken close popup function