files are rewound instead of closed and then reopened