How to fully close a door
The door or frame could be warped, which means replacing or rebuilding one of them.

It's also possible that the door is simply poorly installed, in which case moving the hinges around would solve it.

When you close the door, if TWO corners (out of four) of the door and frame meet, then you can probably get by with moving the hinges. If THREE corners meet, then you've got a warped door or frame.