Make global variables local

This fixes mocha's 'checkGlobals' failures due to global variables when using memjs module.