Constructor which returns a new MemoryFile object using mode. Valid mode are 'r' (read), 'w' (write) or 'rw' (read-write). Default is 'rw'.