Properly handle the window being closed (by saving). Also, reattaching stdout/stderr on Windows.

git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8186 c06c8d41-db1a-0410-9941-cceddc491573

Created by  ennewalker  on January 3, 2009
XZY5YCRL626MBIAYGZBMFCLAXG7UFVEMTSAUQIUMTJDLCHIT7SBQC
Change contents