send stop message before closing