Please try the following way:
<apex:actionFunction name="quickSaveJavascript" action="{!quicksave}" oncomplete="window.top.close();"/>
<apex:commandButton value="Save" onclick="quickSaveJavascript();"/>
=====================
If the above doesn't work, another option is to use Visualforce Remoting, but for that you need custom controller
In javascript, call Visualforce Remoting
CustomController.save(
records,
function () {
window.top.close();
}
)
If my answer works for you, please mark it as accepted.