Merge pull request #241 from mpeuster/master

Improved API shutdown