#10 added debug message for already closed filehandle