Blender Python Scripting Screen Layout Closes on Execution in Windows OS G'day,

I'm using Blender 2.78 64 bit in Windows 7.
I'm trying to use the Scripting Screen layout to run, debug and edit python scripts.

When I press the Run Script button in Blender, the screen layout reverts to the default layout which closes the Scripting Window and the Python Interactive Console. Then to rerun the script I need to reopen the Scripting layout and import the python code back into the Scripting window (very frustrating).

Is there any way to stop Blender from reverting back to the default layout when python scripts are run?

Or, is there a way to make the Scripting screen layout the default layout?

I have seen some suggestions about including input() or raw_input() at the end of the code to prevent the python console from closing. This solution has not worked, raw_input() causes Blender to hang (python console is 3.5.2). Surely there must be a better solution than using raw_input() to pause completion of the script in any case.

Any suggestions would be greatly appreciated.

Thanks.
Thanks very much for the responses. Zeffii is correct, I had used the following code to delete all objects, but it was also resetting the view. Removing the below code resolves the issue. Thanks again.

def reset_blend():
    bpy.ops.wm.read_factory_settings()

    for scene in bpy.data.scenes:
        for obj in scene.objects:
            scene.objects.unlink(obj)

    for bpy_data_iter in (
            bpy.data.objects,
            bpy.data.meshes,
            bpy.data.lamps,
            bpy.data.cameras,
            ):
        for id_data in bpy_data_iter:
            bpy_data_iter.remove(id_data)

reset_blend()