Make isClosed volatile for cross-thread visibility.