Close MariaDB connection on timeout