Wrap log in a try-catch to prevent unhandled exceptions for an unexpectedly closed Writer