How to freeze the game when playing an ad?

Im trying to make my game so that after every 5 times the person plays, it shows an ad. However whenevr I show an ad, the game continues in the background. I made it so that it freezes time, and resumes when the ad is skipped, finished or failed, but it doesnt work. Is that a problem in the script or a problem because it isnt a real ad?

using UnityEngine;
using UnityEngine.Advertisements;

public class UnityAds : MonoBehaviour
{

	public void ShowAd()
	{
		int newNum = PlayerPrefs.GetInt ("count");

		if (Advertisement.IsReady())
		{
			if(PlayerPrefs.GetInt("count") > 5){
				Time.timeScale = 0;
		
			Advertisement.Show();
				PlayerPrefs.SetInt("count", 0);
			}
			else{
				PlayerPrefs.SetInt("count", newNum+5);	

			}
		}
	}
	private void HandleShowResult(ShowResult result){
		switch (result) {
		case ShowResult.Finished:
			Time.timeScale = 1;
			break;
		case ShowResult.Skipped:
			Time.timeScale = 1;
			break;
		case ShowResult.Failed:
			Time.timeScale = 1;
			break;
		}
	}

}

Couldn’t reproduce. Are you sure about adding 5 in newNum instead of 1 ?
try :

else
        {
            PlayerPrefs.SetInt("count", newNum+1);    
        }

Did you enable test mode in Window - > Services ?