Ensure file closed