Tesla posts wider loss on higher r&d expenses