Handle shutdown signal