added error handling and work arounds for gui failing to close, BZ: 924365