Release mutex on exit