Graceful shutdown in Scala scheduler