Fix shutdown function being always None

Problem reported by @IvanMalison
Undo renaming args to kwargs
Merge pull request #867 from ZyX-I/fix-shutdown

Fix shutdown function being always None