How to mysql_close in custome entrypoint

I try to close connection in custom entrypoint

by using 

$db->mysql_close();

got an error:

Fatal error: Call to undefined method MysqliManager::mysql_close() in /var/www/sugarcrm/htdocs/custom/logic.php on line 145

in my logic.php look like this in to end of line throw error

global $db;
$db->query("SET NAMES UTF8");
$result = $db->query($statement);
while ( $row = $db->fetchByAssoc($result) ) {
//...bla bla
}
$db->mysql_close();

How to close connection in custom entrypoint ?

Sugar 7.6 

Thanks,

M