RunningTask.close() is now idempotent

This closes #895 by making `RunningTask.close()` idempotent. It also changes `RunningTask.close(byte[])` to throw an Exception when the Task is no longer in state `RUNNING`