@how123,
In the context, "Give me the hammer" is correct, because it is addressing dirrectly 2nd person.
Similarly "Please close the window" is correct.
When you describing an event in reference to 3rd person, it's correct to say: "he 'gives me the hammer' and...".
However it's totally incorrect: "Please closes the window" because of two words collide with each other: 'please' - addressing 2nd person, and 'closes' - refers to 3rd person. The word "closes" you can only use in something similar to: "as he 'closes the window' she walks to the room and..."
I hope this helpful.