Why is my pipe not being shut?