fix window cleanup bugs & give prompt its own cleanup func