Release thread memory for request_handler

The request handler thread was leaking memory. The two issues that
were addressed with this patch were setting detaching the thread from
the main thread and also stopping the thread once no sessions existed.