add graceful shutdown