Add lock block to avoid crash in temp curve dumping

Spamming the temp curve dump button is capable of causing a crash.  Adding a lock to the file-writing function should solve that.