Vapor cavity formation in a pipe after valve closure