Implemented bug fixes for the views to be closed when the app is closed