Restrict when to release locks going out of scope

Fixes #6

Forked processes must release their locks explicitly.

Thanks to @ned21 and Gabor for the report and details.