Man rescued and arrested after being trapped in abandoned building