Add methods for graceful shutdown