Optimization (faster to check flag).

Checking a flag for opening is a lot faster than checking if the
filehandle is defined. Speeds up nytprof target from 7.05s to 4.89s.
Merge pull request #247 from mmcclimon/optimization

Optimization (faster to check flag).