Karachi Stock Exchange ends up, rupee weakens