Code for creating and destroying the main window

A vital part of a complete breakfast.