[Git Pull request] Closing several resources on exception

Hi,

Please pull from git://github.com/stevenpost/jenkins.git my-fixes
last commit is 4b6fddd07dd4a98b88c3a15ff930b32ebd6bb151
This branch contains a few fixes to close some resources when an exception occurs.
Mainly FileWriter that was not closed on exception.

Regards,
Steven