free memory at the end of pipeline