save the pointer to the priv data before destroying the connection structure

since we still need to call the eof handler for the filedescriptor being closed