So whenever I create a new version using a method, for some reason the form gets closed any idea why that happens?
Yes my sample was the client version cause you never mentioned what you use :D.
Try to provide more details when you ask questions! When you just ask your question in one sentence without code sample or further explanation it´s very hard for other users to understand what you try to do.
For server Method it should be enough when you return your versioned item
--> return myThis;
But I am not sure if this one will work inside the lifecycle.