Use with-statment when opening files to avoid leaking file descriptors.

Signed-off-by: Even Wiik Thomassen <eventh@gmail.com>
Remove extranous white-space and simplify '== True' comparisons.

Signed-off-by: Even Wiik Thomassen <eventh@gmail.com>
Merge pull request #6 from eventh/fixes

Use with-statement to avoid leaking file-descriptors.