peekevent + waittimer = ???

BlitzPlus Forums/BlitzPlus Programming/peekevent + waittimer = ???

Problem:

window=CreateWindow("WFT",300,300,300,300)

timer=CreateTimer(60)

Repeat
	e=PeekEvent()
	WaitTimer(timer)
Until KeyDown(1) Or e=$803


You can quit with escape, but the close button for the window is extremely flakey. I want to use a timer to guarantee maximum gamespeed, but I also need to know if the user is trying to close the window. Any ideas?