Fixing the finally code which wasn't null-protecting, catching an exception in the code I'd previously 'fixed' and removing the outputStream variable as it was unused