override shutdown() in order to shutdown gracefully.