delete allocated memory for before and after pipe arrays