Closing any piped filehandle causes the parent process to wait for the child to finish, and returns the status value in $?.