fix silly bug where output file handle wasn't being opened