added shutdownFunc arg for custom shutdown behavior used by teachpub