added more includes; added event for close window; added the gui and set the state;