Fixed print() on closed filehandle