implement graceful shutdown in native
Merge pull request #258 from LudwigOrtmann/native_shutdown

implement graceful shutdown in native