The file definitely does not exist, but I am getting an error anyway.
$ rm /tmp/records_materialized_view.txt;
$ mysql ...
> SELECT * FROM records_materialized_view INTO OUTFILE '/tmp/records_materialized_view.txt';
ERROR 1086 (HY000): File '/tmp/records_materialized_view.txt' already exists
SELECT INTO OUTFILE writes results to a server file.
Are you checking for the file existence on server?
If you want to select into a local file on your client machine, just redirect
mysql mydb < script.sql > /tmp/records_materialized_view.txt