From Xojo Documentation
|NOTE: Whenever you inadvertently catch an ThreadEndException, you MUST re-raise it. Failing to do so will mess up the runtime environment and lead to unpredictable problems. See Exception statement for more information about its proper use.|
An Exception block can catch a ThreadEndException when you use a catch-all exception statement, i.e. "Exception err as RuntimeException" instead of giving a more specific runtime exception class. In such a case, you MUST re-raise the exception to avoid messing up the runtime environment and create some unpredictable problems.
If err IsA EndException Or err IsA ThreadEndException Then
Raise err // Re-raise the exception
//Continue your code here