cleanup leaks
shutdown sma properly