I'd make this an AtomicBoolean (to avoid the synchronized scope in close())