Pipe handling apparatus and security mechanism