Fix for BSD mktemp

`template` must be provided when using BSD mktemp.