fixing a few final bugs, adding Escape-to-close