isOpen not working appropriately, use tryCatch hack