Thread safety for mkUnique.

Using MVar rather than IORef.