a bunch of changes to ensure proper sequencing in gdb

need to ensure the session gets a chance to finish before
we quit, so we need a final state called FINISHED and then
the session thread can transition from FINISHED to INIT
to signify that the session is done.