You have to keep the account open. If you close it your redirection will immediately stop and your email address could eventually become available for someone else to register. This could lead to someone impersonating you for malicious purposes.
In fact, I can't remember the details now, but there was a big issue a couple of years ago where people were hijacking other people's online accounts by registering an old address and starting to receive emails sent to the previous owner who hadn't updated their records (think sending out password reset emails for example). There is a reference to it here, but I can't find the original story now.
However, whilst searching for that, I also found this:
Yahoo! has “temporarily disabled” the ability to forward email from
its messaging services.
So you might not be able to do what you want anyway.
Here's the original story I referred to.