protected void checkClosed() throws IllegalStateException { if (references.get() < 0) throw new IllegalStateException("Closed " + this); }
No because 0 is the state of an open handler with no references. If it was <= 0, then first call to getVirtualFile() would fail with an IllegalStateException.