Updated performance shutdown part

Added the persistend shutdown part.
Fixed stupid bug