modifed backgroundjs to allow app windoow to close