Former captain Mahela Jayawardene was given a fairytale sendoff in his last test match as Sri Lanka eased to a 105-run victory that completed a 2-0 series sweep over Pakistan.