weird loopy jamming my app

BlitzPlus Forums/BlitzPlus Beginners Area/weird loopy jamming my app

I really need to master loops of all kind but theres no tutorial on them anywhere. My problem here is something in my loop is jamming all the closing app events.. like with the [X] and Cancel button.

Repeat
	;--------------------------------------------------------------------------
	; Gadget Generated Action
	;--------------------------------------------------------------------------
	If(WaitEvent()=$803) Then
		End
	EndIf
	
	If(EventSource()=mStart) Then
		Notify "This would start the game if there was one..."
	EndIf
	If(EventSource()=mCancel) Then
		End
	EndIf
	If(EventSource()=mtest) Then
		SCREEN=1
	EndIf
	;--------------------------------------------------------------------------
	; Screen Loop
	;--------------------------------------------------------------------------
	Select SCREEN
		Case 0
		; Neutral Space
		
		Case 1
		Repeat
			SetGadgetText txt_ini_total_dl, "Fetching First File..."
			timer = CreateTimer(5)
			If WaitEvent()=$4001 Then
				progress# = progress# + 0.01
				UpdateProgBar totalupdate, progress#
			EndIf
			
		Until progress# = 1
		SCREEN = 0
	End Select
	

Until (KeyHit(1))
End

Its probably a stupid error somewhere :|