Polls closed on Wednesday in a national election that looked too close to call, pitting former cricket star Imran Khan against the party of jailed ex-Prime Minister Nawaz Sharif.