More robust global export

Change the method used for exporting the Handlebars global because if
we're wrapped in an IIFE, it's no longer properly exported.  fixes #539

I've done some smoke tests on an already built version of Handlebars and
this should work fine, but I can't for the life of me get Handlebars to
build/test on my Windows environment, so I'd appreciate if someone could
run the test suite on this.