added mac support, removed warning, added closeFunc