2009-06-23 morrowa BROKEN COMMIT. Majority of code to handle closing has been added. Listeners do not close correctly.