Reintroduced cleanup for init
Removed lock comment
Updated windows mex
Updated mac mex
Merge pull request #1 from cafarm/terminate

Reintroduced cleanup for init