procedure TWinForm1.Button2_Click(sender: System.Object; e: System.EventArgs);
You are attempting to close the form from a method of the form itself - and inside the method, you are declaring a local variable and calling it "varForm" of type TwinForm1.
What's happened here is that when you call "varForm.Close", you are calling on that local variable, which doesn't have anything actually assigned to it - so you get a null reference.
If you just want to refer to a method of an object from within a method of the same object, just use "self" - it's an automatically created reference for you. In this example, use self.close and you'll be fine.