-Added new code to attempt a cleaner file closing, but still fails
(although it doesn't crash);