I have the same problem on zucchini and cucumber. I removed the cucumber plant altogether because it had finished. I might remove the worst leaves on the zucchini but for sure will pull the plants when they are finished. This Extension article says don't compost them: