#14 take already opened file into account