Try fixing race condition in fftw by adding mutex for fftw_* function calls suggested here: http://www.fftw.org/fftw3_doc/Thread-safety.html. Updates #4643.