Troubled cargo ship cleared to leave Aust