SOUND: Fix possible resource leak reported by Coverity.
Rewrite WAV loader to be more readable and use fstream instead of FILE to fix the leak.