clean up javascript, implement window close solution for atom iframes