So, your intent is to have Form A open, click a button and Form A closes and Form B appears.
The problem you have is that Form A happens to be the Main form of you application (the one that is set to run on start up). Whenever the main form is closed the application will try to shut down and will close all other forms.
If you open Form A from your Main form and then try to swap open forms it should work.