If you close the door it won't be able to come in.
But there's nothing you can do to avoid this fight, you have to kill it.
At least now you have a weapon.