Work around windows multiprocessing bug

Set __opts__['test'] back to it's prior value at the end of the various
functions in salt.modules.state which use it.

Fixes #7714.