shuts down properly