Avoid deadlock when raising an error with GST_ELEMENT_ERROR

If an element is locked with GST_OBJECT_LOCK and an error is
raised through GST_ELEMENT_ERROR the element will deadlock
because GST_ELEMENT_ERROR  will try to lock the element
mutex which is already locked at this point.

This commit rectifies the problem by unlocking the element before
the error is raised or by removig locking where it's not needed.