Fixes findbugs warning - dereferencing null in exception case
Merge pull request #98 from simonharrer/close-resources-correctly

Fixes findbugs warning - dereferencing null in exception case