cleanup of gui in main()