Checks if last tab is saved before terminating program.