Event listener for clicking on back button