Hi Richard,
If you have threads still running when the main thread closes then the app will remain in memory, until the thread completes (and usually at that point GPF's).
The easiest "fix" for this is the Graceful Button control template which you can add to the WebServer procedure. This stops new requests, but waits until active threads have closed before closing the main server.
Of course if you have "endless threads" in your app then the server will never close. But that's a bug you should investigate and fix.
cheers
Bruce