Intelligent power off