Fixed for memory mode

Previously, we were rereading the file for every thread, which is wrong and caused exceptions if the file changed.