delete unecessary output.closing files.