Cleanup + ClosePipe implementation