Former Pakistan PM Imran Khan apologises in court as he bids to stay out of jail and avoid contempt charges after he criticised judges’ treatment of his chief of staff