When tearing down the connection make sure we close all files before