core: fix for locks not being released in sync commands

This patch fix the following problem: when acquiring locks inside
a command which has a synchronous flow and set not to release its
locks after the 'execute' method, the locks remain forever in the
synchronous flow since the end-action is not called.

Note: synchronous flow means there are no tasks being created in the
execute method. for example: when exporting a template that has no
disks.

The solution is to release the locks at the end of the 'execute' method
if the command has no tasks.

Change-Id: I8f39b924327fb0a8e1081ca9bde6b24f489a7c1e
Signed-off-by: Arik Hadas <ahadas@redhat.com>