Merge pull request #1389 from rubenk/perl-unlock-on-error