anchor.diff:              let c = {c with alert = new_al_state;
                               write = new_write}
               (correct (Done), Conn(id,c))
  -        | Error (x,y) -> (Error(x,y), closeConnection (Conn(id,c))) (* Unrecoverable error *)
  +        | Error (x,y) -> let closed = closeConnection (Conn(id,c)) in (Error(x,y), closed) (* Unrecoverable error *)
   
   (* we have received, decrypted, and verified a record (ct,f); what to do? *)
   let deliver (Conn(id,c)) ct tlen frag = 
  
positive.code:                                 let new_write = {disp = Finishing; conn = ss; seqn = 0} in
                                  let c = { c with handshake = new_hs_state;
                                                               write = new_write }
                                  (correct (WriteAgain), Conn(id,c) )
                              else
                                  (Error(Dispatcher, UserAborted), closeConnection (Conn(id,c))) (* TODO: we might want to send an "internal error" fatal alert *)
                          | Error (x,y) -> (Error (x,y), closeConnection (Conn(id,c))) (* Unrecoverable error *)
                      | _ -> (Error(Dispatcher, InvalidState), closeConnection (Conn(id,c))) (* TODO: we might want to send an "internal error" fatal alert *)
            | (Handshake.HSFrag(tlen,f),new_hs_state) ->     
                        (* we send some handshake fragment *)
                        match c_write.disp with
  
negative.code:                             let c = { c with handshake = new_hs_state;
                                               write     = new_write }
                              (correct (WriteAgain), Conn(id,c) )
                            | Error (x,y) -> let closed = closeConnection (Conn(id,c)) in (Error(x,y), closed) (* Unrecoverable error *)
                        | _ -> let closed = closeConnection (Conn(id,c)) in (Error(Dispatcher,InvalidState), closed) (* TODO: we might want to send an "internal error" fatal alert *)
            | (Handshake.HSWriteSideFinished(tlen,lastFrag),new_hs_state) ->
                  (* check we are in finishing state *)
                  match c_write.disp with
  