added closeOnMax option