if you pick a key up as a ghost you have to insert it into the door as a ghost too, maybe that's what happened