Fixed a mutex leak.
Fixed NULL pointer dereference bug.
Minor performance improvement.
Fixed erroneous check for CreateFileMapping success. CreateFileMapping returns NULL on error.
Fix bug introduced in 3a7fe213404e91022a5c678e3d47bd732d4bd61f