Added close/onclose methods to views and clean up home page when leaving.