Fix build issues with event loop

Provide a clean shutdown for the native event loop
Merge pull request #14 from skabbes/fix/event_loop

Fix build issues with event loop