[gnutls] fix cleanup order (use-after-free)