Making sure we close filehandles (Closes #238)