sgwdynspeed: properly close the speed file