Fix getEmitOutput to only output one file except when 'out' flag is specified. Add testcases
Fix declaring function for writer and setting writer to undefined
Add getEmitOutput baselines