Allow overwriting the src file with optimized

Fixes "Fatal error: ENOENT, no such file or directory" when src and dest are the same.