There are no visible gaps there, whereas 245 has one. And you've been taught that it's better to have no gaps than one gap. To be completely open, the straight flush would have to have two spaces above and two spaces below. As an example of how a completely open straight flush is different, look at 345, all of diamonds. Three combinations rather than two means that 345 is more valuable than 234.
Every game has slightly different strategy rule comparing straight flushes and high cards.
Again, different game means different strategy rules. Now let us look at the 4d 6d 8d combination. This is a double inside straight flush, which is another way to say it has two gaps. Notice that only one combination, specifically 5d7d, can fill the straight flush. Not surprisingly, it is worth less than the straight flushes with one gap.