Move all user defaults to M2GlobalState and fix memory leak

Moves setting of default user defaults to M2GlobalState, switching to use of `-registerDefaults:` method in the process, and using constants for default key names.

Also fix a potential memory leak with a retained CGPathRef, as identified by XCode's static analysis.