Not sure whether you want to hear this or not but I believe in ghosts and I also believe that animals can see them. If it happens again, open your door and tell the ghost that they have to leave because you aren't ready for them to be in your house. The ghost should leave because they are no longer welcome in the house.