Fix single instance not working.

Add platform independent mutex.