Bach actually wrote two toccata-and-fugue pairs in D minor, both in 1708. The most famous one (appeared in the original Fantasia movie, and often used as a stock piece of generic "scary music") is BWV 565. The other, sometimes called the "Dorian" toccata and fugue, is BWV 538. Check the number if you're looking to buy a recording!