Simplify implementation

Use the `suffix` argument to create a temporary file with the same
extension
Fix windows tests