[Mac] Correctly release mach port

The event tap is released automatically along with the mach port. Fixes
crash on shutdown.
[Mac] Do not use autorelease pool

Avoids a potential crash on shutdown.
[Mac] Release input driver before other resources

The input driver relies on the existence of a CFRunLoop. Releasing it
first ensures that a CFRunLoop is available for its complete life cycle.