Output file remained open and could not be accessed