properly terminate after running maintenance commands.