finish page function