Various fixes for the flac encoder

Not sure what you have tracklength set to, but this stops it crashing (the only values that seem to function well are 0 and something about the right length).  My guess is it's trying to call seek callbacks or something, but haven't explored that far (clobbered stack is the result).