Move save to file to text api

Implements a safe save function (write to a temp file before renaming to
desired file path)
Fix examples