Prevent an NPE when the writer has not been opened due to an earlier SQL failure.