It doesn't look like we ever close this file once we open it. We probably don't want to close the IO object given by the user, so maybe it would be best to perform the read here within the if block.