global: free the error message when exiting a thread

When we free the global state at thread termination, we must also free
the error message in order not to leak the string once per thread.
Merge pull request #2559 from libgit2/cmn/free-tls-error

global: free the error message when exiting a thread