fixed old problem with printing exceptions stack trace before ui is closed