You cannot do so.
A procedure - whether a sub or a function- is defined as a 'temporary branch' from the current flow and will always return to the originating code.
If you want to close the form after the procedure has run then you should put the close form command immediately after the call to the sub/function in the calling procedure.