move remove_global_thread() out of the lock

..since it locks the same mutex, causing deadlock.

This fixes https://bugs.launchpad.net/percona-server/+bug/1319904
See this comment for more details: https://bugs.launchpad.net/percona-server/+bug/1319904/comments/8