Moved tab container outside of individual file functions since it was required by so many; added check for modified status before closing