attempt to solve issue with application hanging onto files permanently
another attempt to make sure files are being closed properly