Added close function to pages