See my comment in close() method below.
If init() throws exception, htable would be null. With an additional null check, writer.close() should be a no-op.