Fix bash check in shell magic
Fix shutdown behavior on Windows