Added the functionality to delete file segments if they exist