Fixed closing of open file-handles.