Fixed error returns for all API Functions.

Previously forgot to unlock mutex and close eeproms for error returns.
This would result in all API calls after a failure to hang forever.
Fixed by adding unlock and close.